Environment.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 4 totaltotal 59.5% 25 / 42 CC 4 SCAR 10.0
CC
4
Cov
66%
error
6.0
os_supported
2.3
new
2.0
CRAP 2.7
« Environment/Linux.pm ↑ Summary
1 ###########################################
2 package Proc::Info::Environment;
3 ###########################################
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = "0.01";
8  
9 1 our %OS_MAP = (
10 "linux" => "Linux",
11 );
12  
13 ###########################################
14 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod undocumented
15 ###########################################
16 1 my($class, %options) = @_;
17  
18 1 my $self = {
19 %options,
20 };
21  
22 1 my $os = $OS_MAP{ $^O };
23  
24 1 ▶ if(! defined $os ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $os) 0 1 1
25 0 die "OS $^O not supported";
26 }
27  
28 1 my $subclass = "Proc::Info::Environment::$os";
29 1 eval "require $subclass";
30  
31 1 bless $self, $subclass;
32  
33 1 return $self;
34 }
35  
36 ###########################################
37 0 ▶sub os_not_supported_error_message {
Subroutine os_not_supported_error_message: not called CC=1 SCAR=6.9
Pod undocumented
38 ###########################################
39 0 return "OS $^O not supported (only " .
40 join(', ', sort keys %OS_MAP) .
41 " so far)";
42 }
43  
44 ###########################################
45 1 ▶sub os_supported {
Subroutine os_supported: called CC=2 SCAR=8.1
Pod undocumented
46 ###########################################
47 1 ▶ if(exists $OS_MAP{ $^O } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $Proc::Info::Environment::OS_MAP{$^O}) 1 0 1
48 1 return 1;
49 }
50  
51 0 return 0;
52 }
53  
54 ###########################################
55 0 ▶sub error {
Subroutine error: not called CC=2 SCAR=17.9
Pod undocumented
56 ###########################################
57 0 my($self, $error) = @_;
58  
59 0 ▶ if(defined $error) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $error) 0 0 0
60 0 $self->{error} = $error;
61 }
62  
63 0 return $self->{error};
64 }
65  
66 1 1;
67  
68 __END__
« Environment/Linux.pm ↑ Summary