POHI has asked for the wisdom of the Perl Monks concerning the following question:
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. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CPU informations - strange errors
by toolic (Bishop) on Oct 21, 2015 at 12:33 UTC | |
|
Re: CPU informations - strange errors
by GotToBTru (Prior) on Oct 21, 2015 at 12:31 UTC | |
by POHI (Initiate) on Oct 22, 2015 at 09:29 UTC |