line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Platform::Info::BSD; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
8327
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
122
|
|
4
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
106
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
13
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
1323
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.15'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub new { |
23
|
0
|
|
|
0
|
1
|
|
my ($class) = @_; |
24
|
0
|
|
|
|
|
|
my $self = {}; |
25
|
0
|
|
|
|
|
|
bless $self, $class; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_info { |
31
|
0
|
|
|
0
|
1
|
|
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
|
0
|
|
|
|
|
$self->{info}{$cmd} = $self->{cmds}{$cmd} if($cmd !~ /^_/); |
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
|
0
|
|
|
|
|
$self->{info}{is32bit} = $self->{info}{archname} !~ /(64|alpha)/ ? 1 : 0; |
47
|
0
|
0
|
|
|
|
|
$self->{info}{is64bit} = $self->{info}{archname} =~ /(64|alpha)/ ? 1 : 0; |
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
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |