Dear Monks, I have to get some CPU informations independent (!) from OS. I saw many posts about that but I get a strange error and I hope you can help me.

What I do:

I get this Package http://search.cpan.org/~burak/Sys-Info-Base-0.7804/lib/Sys/Info/Device/CPU.pm and did what it's written about. I use cygwin.
use Sys::Info; use Sys::Info::Constants qw( :device_cpu ); use Sys::Info::Driver::Unknown::Device::CPU; # for cygwin (?) my $info = Sys::Info->new; # alternative 1 http://search.cpan.org/~burak/Sys-Info-Base-0.7804/lib +/Sys/Info/Device/CPU.pm my $cpu = $info->device( CPU => %options ); #line 19 # alternative 2 $info->device( 'CPU' ); printf "CPU freq %s MHz\n", $cpu->speed; #line 22 printf "%d CPUs\n" , $cpu->count ;

What I get:

# alternative 1 Global symbol "%options" requires explicit package name at pcData.pl l +ine 19. Execution of pcData.pl aborted due to compilation errors. #alternative 2 Odd number of elements in hash assignment at /usr/lib/perl5/site_perl/ +5.14/Sys/Info/Driver/Unknown/Device/CPU/Env.pm line 26. Use of uninitialized value $family in hash element at /usr/lib/perl5/s +ite_perl/5.14/Sys/Info/Driver/Unknown/Device/CPU/Env.pm line 86. Use of uninitialized value in printf at pcData.pl line 22.

What should I do?

Have someone a hint for me? What options in %options are possible and how I can/should configure it? What means the output in alternative 2? Is this a nice way or is there a nicer way to get this informations? I learned Perl 2-3 weeks ago so sorry for annoying you for this thing if it's a basic topic. :)

In reply to CPU informations - strange errors by POHI

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.