| 1 | package Devel::Platform::Info::BSD; | ||||||||||
| 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 | '_uname2' => 'uname -mrr', | ||||||||||
| 14 | 'kname' => 'uname -s', | ||||||||||
| 15 | 'kvers' => 'uname -r', | ||||||||||
| 16 | 'osname' => 'uname -o', | ||||||||||
| 17 | 'archname' => 'uname -m', | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | #---------------------------------------------------------------------------- | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 23 | 0 | my ($class) = @_; | |||||||||
| 24 | 0 | my $self = {}; | |||||||||
| 25 | 0 | bless $self, $class; | |||||||||
| 26 | |||||||||||
| 27 | 0 | return $self; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub get_info { | ||||||||
|
Subroutine
get_info: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 31 | 0 | my $self = shift; | |||||||||
| 32 | |||||||||||
| 33 | 0 | for my $cmd (keys %commands) { | |||||||||
| 34 | 0 | $self->{cmds}{$cmd} = `$commands{$cmd} 2>/dev/null`; | |||||||||
| 35 | 0 | $self->{cmds}{$cmd} =~ s/\s+$//s; | |||||||||
| 36 | 0 | ▶ | $self->{info}{$cmd} = $self->{cmds}{$cmd} if($cmd !~ /^_/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | $self->{info}{osflag} = $^O; | |||||||||
| 40 | 0 | $self->{info}{kvers} = lc $self->{info}{kvers}; | |||||||||
| 41 | 0 | $self->{info}{kernel} = lc($self->{info}{kname}) . '-' . $self->{info}{kvers}; | |||||||||
| 42 | 0 | $self->{info}{osname} = $self->{info}{kname}; | |||||||||
| 43 | 0 | $self->{info}{oslabel} = $self->{info}{kname}; | |||||||||
| 44 | 0 | $self->{info}{osvers} = $self->{info}{kvers}; | |||||||||
| 45 | 0 | $self->{info}{osvers} =~ s/-release.*//; | |||||||||
| 46 | 0 | ▶ | $self->{info}{is32bit} = $self->{info}{archname} !~ /(64|alpha)/ ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | ▶ | $self->{info}{is64bit} = $self->{info}{archname} =~ /(64|alpha)/ ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | |||||||||||
| 49 | # NOTE: 'sparc64' (64bit) and 'sparc' (32bit) both look like they identify | ||||||||||
| 50 | # themselves as archname = 'sparc'. If true, is there any other way to | ||||||||||
| 51 | # easily distinguish the difference? | ||||||||||
| 52 | |||||||||||
| 53 | 0 | $self->{info}{source}{$commands{$_}} = $self->{cmds}{$_} for(keys %commands); | |||||||||
| 54 | 0 | return $self->{info}; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | #---------------------------------------------------------------------------- | ||||||||||
| 58 | |||||||||||
| 59 | 4 | 1; | |||||||||
| 60 | |||||||||||
| 61 | __END__ | ||||||||||