System::Info(3pm)
π System::Info π
okay bestie, welcome to System::Info, dropping in from your friendly neighborhood User Contributed Perl Documentation section (that's the manual it lives in, iykyk) π
β¨ NAME β¨
System::Info β it's a factory for system specific information objects ππ¦
πΈ SYNOPSIS πΈ
like, here's the vibe:
use System::Info;
my $si = System::Info->new;
printf "Hostname: %s\n", $si->host;
printf "Number of CPU's: %s\n", $si->ncpu;
printf "Processor type: %s\n", $si->cpu_type; # short
printf "Processor description: %s\n", $si->cpu; # long
printf "OS and version: %s\n", $si->os;
or β¨
use System::Info qw( sysinfo );
printf "[%s]\n", sysinfo ();
or, and this one is giving command-line main character energy:
$ perl -MSystem::Info=si_uname -le print+si_uname
π DESCRIPTION π
okay so System::Info literally tries to present all the system-related info β like the number of CPU's, the architecture, the OS, and the release-related tea β¨ β in a system-independent way.
and the whole point? it releases you, the user of this module, from needing to know whether the info is coming from Windows, Linux, HP-UX, AIX, Solaris, Irix, or VMS, and whether the architecture is i386, x64, pa-risc2, or arm. no cap. you just ask, it just answers π«Ά
π₯ METHODS π₯
π System::Info->new
Factory method, bestie. And if everything goes sideways, it falls back to the information in "POSIX::uname ()" π
π sysinfo
"sysinfo" returns a string with "host", "os" and "cpu_type". that's it, that's the tweet π
π sysinfo_hash
"sysinfo_hash" returns a hash reference with basic system information, like:
{ cpu => 'Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz (GenuineIntel 2700MHz)',
cpu_count => '1 [8 cores]',
cpu_cores => 8,
cpu_type => 'x86_64',
distro => 'openSUSE Tumbleweed 20171030',
hostname => 'foobar',
os => 'linux - 4.13.10-1-default [openSUSE Tumbleweed 20171030]',
osname => 'Linux',
osvers => '4.13.10-1-default'
}
quick note bestie: the "cpu_cores" count refers to logical cores. On MacOS there's also a "physical_cores" count, which will be the same as "cpu_cores" for Apple Silicon, but not for an Intel Mac with SMT enabled:
{ cpu => 'Quad-Core Intel Core i7 (2 GHz)',
cpu_count => '1 [4 cores]',
cpu_cores => '8',
physical_cores => '4',
cpu_type => 'x86_64',
distro => 'Darwin 11.7.10',
hostname => '192.168.1.6',
os => 'darwin - 20.6.0 (Mac OS X - macOS 11.7.10 (20G1427))',
osname => 'Darwin',
osvers => '11.7.10'
}
π si_uname (@args)
This class gathers most of the uname(1) info, and makes a comparable version. It takes almost the same arguments:
afor all (can be omitted)nfor nodenamesfor os name and versionmfor cpu namecfor cpu countpfor cpu_type
π¦ SEE ALSO π¦
okay so there are, like, more modules that provide system and/or architectural information. here's the thing though β where System::Info aims at returning the information that is useful for bug reports, some other modules focus on a single aspect (possibly with way more variables and methods than System::Info does supports), or are limited to use on a specific architecture, like Windows or Linux.
so here are some of the alternatives, and how to replace that code with what System::Info offers π«Ά not all returned values will be exactly the same, bestie, just so you know.
πΈ Sys::Hostname
use Sys::Hostname;
say "Hostname: ", hostname;
->
use System::Info;
my $si = System::Info->new;
say "Hostname: ", $si->host;
Sys::Hostname is a CORE module, and will always be available. slay β¨
πΈ Unix::Processors
use Unix::Processors;
my $up = Unix::Processors->new;
say "CPU type : ", $up->processors->[0]->type; # Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
say "CPU count: ", $up->max_physical; # 4
say "CPU cores: ", $up->max_online; # 8
say "CPU speed: ", $up->max_clock; # 2700
->
use System::Info;
my $si = System::Info->new;
say "CPU type : ", $si->cpu;
say "CPU count: ", $si->ncpu;
say "CPU cores: ", $si->ncore;
say "CPU speed: ", $si->cpu =~ s{^.*\b([0-9.]+)\s*[A-Z]Hz.*}{$1}r;
heads up bestie: the number reported by max_physical is inaccurate for modern CPU's π
πΈ Sys::Info
Sys::Info has a somewhat rigid configuration, which causes it to fail installation on e.g. (modern versions of) CentOS and openSUSE Tumbleweed π
It aims at returning a complete set of information, but as I cannot install it on openSUSE Tumbleweed, I cannot test it and show the analogies. that's the whole update, sorry bestie π
πΈ Sys::CPU
use Sys::CPU;
say "CPU type : ", Sys::CPU::cpu_type; # Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
say "CPU count: ", Sys::CPU::cpu_count; # 8
say "CPU speed: ", Sys::CPU::cpu_clock; # 2700
->
use System::Info;
my $si = System::Info->new;
say "CPU type : ", $si->get_cpu; # or ->cpu
say "CPU count: ", $si->get_core_count; # or ->ncore
say "CPU speed: ", $si->get_cpu =~ s{^.*\b([0-9.]+)\s*[A-Z]Hz.*}{$1}r;
the speed reported by Sys::CPU is the current speed, and it will change from call to call. YMMV. π’
Sys::CPU is not available on CPAN anymore, but you can still get is from BackPAN.
πΈ Devel::Platform::Info
Devel::Platform::Info derives information from the files "/etc/issue", "/etc/.issue" and the output of the commands "uname -a" (and "-m", "-o", "-r", and "-s") and "lsb_release -a". It returns no information on CPU type, CPU speed, or Memory.
use Devel::Platform::Info;
my $info = Devel::Platform::Info->new->get_info ();
# { archname => 'x86_64',
# codename => 'n/a',
# is32bit => 0,
# is64bit => 1,
# kernel => 'linux-5.17.4-1-default',
# kname => 'Linux',
# kvers => '5.17.4-1-default',
# osflag => 'linux',
# oslabel => 'openSUSE',
# osname => 'GNU/Linux',
# osvers => '20220426',
# }
->
use System::Info;
my $si = System::Info->new;
my $info = {
archname => $si->cpu_type, # x86_64
codename => undef,
is32bit => undef,
is64bit => undef,
kernel => "$^O-".$si->_osvers, # linux-5.17.4-1-default
kname => $si->_osname, # Linux
kvers => $si->_osvers, # 5.17.4-1-default
osflag => $^O, # linux
oslabel => $si->distro, # openSUSE Tumbleweed 20220426
osname => undef,
osvers => $si->distro, # openSUSE Tumbleweed 20220426
};
πΈ Devel::CheckOS
This one does not return the OS information as such, but features an alternative to $^O. cute, right? π
πΈ Sys::OsRelease
Interface to FreeDesktop.Org's os-release standard.
use Sys::OsRealease;
Sys::OsRelease->init;
my $i = Sys::OsRelease->instance;
say $i->ansi_color; # 0;32
say $i->bug_report_url; # https://bugs.opensuse.org
say $i->cpe_name; # cpe:/o:opensuse:tumbleweed:20220426
say $i->documentation_url; # https://en.opensuse.org/Portal:Tumbleweed
say $i->home_url; # https://www.opensuse.org/
say $i->id; # opensuse-tumbleweed
say $i->id_like; # opensuse suse
say $i->logo; # distributor-logo-Tumbleweed
say $i->name; # openSUSE Tumbleweed
say $i->pretty_name; # openSUSE Tumbleweed
say $i->version_id; # 20220426
π COPYRIGHT AND LICENSE π
(c) 2016-2026, Abe Timmerman & H.Merijn Brand, All rights reserved. π
With contributions from Jarkko Hietaniemi, Campo Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, Rich Rauenzahn, David Cantrell. y'all are iconic π«Ά
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See:
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. no promises, bestie, that's the deal π
and that's a wrap, bestie! this lil doc was generated by perl v5.40.1 and dated 2026-01-25, tagged as System::Info(3pm) β go forth and uname, periodt π
β¨π
π¦ where this page comes from
- ubuntu resolute: libsystem-info-perl 0.067-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsystem-info-perl 0.067-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms