| 1 | package Devel::Platform::Info::Solaris; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 4 | $VERSION = '1.00'; | |||||||||
| 8 | |||||||||||
| 9 | #---------------------------------------------------------------------------- | ||||||||||
| 10 | |||||||||||
| 11 | 4 | my %commands = ( | |||||||||
| 12 | '_uname1' => 'uname -a', | ||||||||||
| 13 | '_showrev' => 'showrev -a | grep -v "^Patch"', | ||||||||||
| 14 | '_release' => 'cat /etc/release', | ||||||||||
| 15 | '_isainfo' => '/usr/bin/isainfo -kv', | ||||||||||
| 16 | 'kname' => 'uname -s', | ||||||||||
| 17 | 'kvers' => 'uname -r', | ||||||||||
| 18 | 'archname' => 'uname -m', | ||||||||||
| 19 | ); | ||||||||||
| 20 | |||||||||||
| 21 | #---------------------------------------------------------------------------- | ||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 0 | my ($class) = @_; | |||||||||
| 25 | 0 | my $self = {}; | |||||||||
| 26 | 0 | bless $self, $class; | |||||||||
| 27 | |||||||||||
| 28 | 0 | return $self; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub get_info { | ||||||||
|
Subroutine
get_info: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||
| 32 | 0 | my $self = shift; | |||||||||
| 33 | |||||||||||
| 34 | 0 | for my $cmd (keys %commands) { | |||||||||
| 35 | 0 | $self->{cmds}{$cmd} = `$commands{$cmd} 2>/dev/null`; | |||||||||
| 36 | 0 | $self->{cmds}{$cmd} =~ s/\s+$//s; | |||||||||
| 37 | 0 | ▶ | $self->{info}{$cmd} = $self->{cmds}{$cmd} if($cmd !~ /^_/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | $self->{info}{osflag} = $^O; | |||||||||
| 41 | 0 | $self->{info}{kernel} = lc($self->{info}{kname}) . '-' . $self->{info}{kvers}; | |||||||||
| 42 | 0 | ▶ | $self->{info}{is32bit} = $self->{cmds}{_isainfo} !~ /64-bit/s ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | ▶ | $self->{info}{is64bit} = $self->{cmds}{_isainfo} =~ /64-bit/s ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | |||||||||||
| 45 | 0 | ($self->{info}{osname}) = $self->{cmds}{_release} =~ /((?:Open)?Solaris|SunOS|OpenIndiana)/is; | |||||||||
| 46 | 0 | $self->{info}{oslabel} = $self->{info}{osname}; | |||||||||
| 47 | 0 | $self->{info}{osvers} = $self->{info}{kvers}; | |||||||||
| 48 | |||||||||||
| 49 | # Solaris versions are based on SunOS, but just slightly different! | ||||||||||
| 50 | 0 | ▶ | if($self->{info}{osname} =~ /Solaris/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | $self->{info}{osvers} =~ s/^5\.([0123456]\b)/2.$1/; | |||||||||
| 52 | 0 | $self->{info}{osvers} =~ s/^5\.(\d+)/$1/; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | # Question: Anyone know how to get the real version number for OpenSolaris? | ||||||||||
| 56 | # i.e. "2008.05" or "2009.06" | ||||||||||
| 57 | |||||||||||
| 58 | 0 | $self->{info}{source}{$commands{$_}} = $self->{cmds}{$_} for(keys %commands); | |||||||||
| 59 | 0 | return $self->{info}; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | #---------------------------------------------------------------------------- | ||||||||||
| 63 | |||||||||||
| 64 | 4 | 1; | |||||||||
| 65 | |||||||||||
| 66 | __END__ | ||||||||||