1System::Info(3) User Contributed Perl Documentation System::Info(3)
2
3
4
6 System::Info - Factory for system specific information objects
7
9 use System::Info;
10
11 my $si = System::Info->new;
12
13 printf "Hostname: %s\n", $si->host;
14 printf "Number of CPU's: %s\n", $si->ncpu;
15 printf "Processor type: %s\n", $si->cpu_type; # short
16 printf "Processor description: %s\n", $si->cpu; # long
17 printf "OS and version: %s\n", $si->os;
18
19 or
20
21 use System::Info qw( sysinfo );
22 printf "[%s]\n", sysinfo ();
23
24 or
25
26 $ perl -MSystem::Info=si_uname -le print+si_uname
27
29 System::Info tries to present system-related information, like number
30 of CPU's, architecture, OS and release related information in a system-
31 independent way. This releases the user of this module of the need to
32 know if the information comes from Windows, Linux, HP-UX, AIX, Solaris,
33 Irix, or VMS, and if the architecture is i386, x64, pa-risc2, or arm.
34
36 System::Info->new
37 Factory method, with fallback to the information in "POSIX::uname ()".
38
39 sysinfo
40 "sysinfo" returns a string with "host", "os" and "cpu_type".
41
42 sysinfo_hash
43 "sysinfo_hash" returns a hash reference with basic system information,
44 like:
45
46 { cpu => 'Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz (GenuineIntel 2700MHz)',
47 cpu_count => '1 [8 cores]',
48 cpu_cores => 8,
49 cpu_type => 'x86_64',
50 distro => 'openSUSE Tumbleweed 20171030',
51 hostname => 'foobar',
52 os => 'linux - 4.13.10-1-default [openSUSE Tumbleweed 20171030]',
53 osname => 'Linux',
54 osvers => '4.13.10-1-default'
55 }
56
57 si_uname (@args)
58 This class gathers most of the uname(1) info, make a comparable
59 version. Takes almost the same arguments:
60
61 a for all (can be omitted)
62 n for nodename
63 s for os name and version
64 m for cpu name
65 c for cpu count
66 p for cpu_type
67
69 (c) 2016-2018, Abe Timmerman & H.Merijn Brand All rights reserved.
70
71 With contributions from Jarkko Hietaniemi, Campo Weijerman, Alan
72 Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, Rich Rauenzahn,
73 David Cantrell.
74
75 This library is free software; you can redistribute it and/or modify it
76 under the same terms as Perl itself.
77
78 See:
79
80 · <http://www.perl.com/perl/misc/Artistic.html>
81
82 · <http://www.gnu.org/copyleft/gpl.html>
83
84 This program is distributed in the hope that it will be useful, but
85 WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
87
88
89
90perl v5.28.0 2018-02-11 System::Info(3)