line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Proc::Info::Environment; |
3
|
|
|
|
|
|
|
########################################### |
4
|
1
|
|
|
1
|
|
44090
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
337
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our %OS_MAP = ( |
10
|
|
|
|
|
|
|
"linux" => "Linux", |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
########################################### |
14
|
|
|
|
|
|
|
sub new { |
15
|
|
|
|
|
|
|
########################################### |
16
|
1
|
|
|
1
|
0
|
11
|
my($class, %options) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
3
|
my $self = { |
19
|
|
|
|
|
|
|
%options, |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
4
|
my $os = $OS_MAP{ $^O }; |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
3
|
if(! defined $os ) { |
25
|
0
|
|
|
|
|
0
|
die "OS $^O not supported"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
3
|
my $subclass = "Proc::Info::Environment::$os"; |
29
|
1
|
|
|
|
|
88
|
eval "require $subclass"; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
5
|
bless $self, $subclass; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
4
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
########################################### |
37
|
|
|
|
|
|
|
sub os_not_supported_error_message { |
38
|
|
|
|
|
|
|
########################################### |
39
|
0
|
|
|
0
|
0
|
0
|
return "OS $^O not supported (only " . |
40
|
|
|
|
|
|
|
join(', ', sort keys %OS_MAP) . |
41
|
|
|
|
|
|
|
" so far)"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
########################################### |
45
|
|
|
|
|
|
|
sub os_supported { |
46
|
|
|
|
|
|
|
########################################### |
47
|
1
|
50
|
|
1
|
0
|
195
|
if(exists $OS_MAP{ $^O } ) { |
48
|
1
|
|
|
|
|
3
|
return 1; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
########################################### |
55
|
|
|
|
|
|
|
sub error { |
56
|
|
|
|
|
|
|
########################################### |
57
|
0
|
|
|
0
|
0
|
|
my($self, $error) = @_; |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
if(defined $error) { |
60
|
0
|
|
|
|
|
|
$self->{error} = $error; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return $self->{error}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |