The POSIX
module in perl provides the uname call, so:
use POSIX qw(uname);
my @uname = uname();
print $uname[0] . " " . $uname[2];
This provides the information from the running system, not from the system that performed the build (which is where the Config
results come from).
In general, though, this information is the kernel
release, and not the marketing version of the product, so for example, this wouldn't tell you if it's a Linux Mint system, just that it's a Linux system running the 3.2.foo kernel.
For lsb based Linux systems, the lsb_release command can give this information e.g. on a linux system I have:
natsu ~> lsb_release -r
Release: 12.04
natsu ~> lsb_release -i
Distributor ID: Ubuntu
This information is in the /etc/lsb-release
file.
For Solaris, the release information is in the /etc/release
file. The first line contains the name of the operating system e.g. Solaris 10 9/10
. There are multiple lines in this file, and it's more of a free-form text field.