3
從Sys::Info::Device:
If DEVICE_ID has the value of available, then the names of the available devices will be returned.
Sys系統::信息 - 問題
爲什麼$info->device('available');
回報沒有設備時,至少有CPU的設備?
#!/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;
輸出:
可用設備:0
芯數:2