From Sys::开发者_高级运维Info::Device:
If DEVICE_ID has the value of available, then the names of the available devices will be returned.
Why does $info->device('available');
return no devices when there is at least the cpu-device?
#!/usr/local/bin/perl
use warnings;
use 5.014;
use Sys::Info;
my $info = Sys::Info->new;
my @available = $info->device('available');
say 'Available devices: ', scalar @available;
my $cpu = $info->device( 'CPU' );
say 'Number of cores: ', $cpu->count;
Output:
Available devices: 0
Number of cores: 2
I get the same output running this on a Mac OS X box. You might contact the developer.
精彩评论