Info.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 92.5% 37 / 40 CC 3 SCAR 6.2
CC
3
Cov
94%
get_info
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« Info/Mac.pm ↑ Summary
1 package Devel::Platform::Info;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 $VERSION = '1.00';
8  
9 #----------------------------------------------------------------------------
10  
11 6 my %map = (
12 # Unix (and like) family OSes
13 'freebsd' => 'BSD',
14 'openbsd' => 'BSD',
15 'netbsd' => 'BSD',
16 'mirbsd' => 'BSD',
17 'dragonfly' => 'BSD',
18 'midnightbsd' => 'BSD',
19
20 'irix' => 'Irix',
21
22 'linux' => 'Linux',
23 'aix' => 'Linux',
24 'bsdos' => 'Linux',
25 'dgux' => 'Linux',
26 'dynixptx' => 'Linux',
27 'hpux' => 'Linux',
28 'dec_osf' => 'Linux',
29 'svr4' => 'Linux',
30 'unicos' => 'Linux',
31 'unicosmk' => 'Linux',
32 'ultrix' => 'Linux',
33
34 'sco_sv' => 'SCO',
35 'sco3' => 'SCO',
36 'sco' => 'SCO',
37  
38 'solaris' => 'Solaris',
39 'sunos' => 'Solaris',
40  
41 'beos' => 'BeOS',
42  
43 # Windows family OSes
44 'dos' => 'Win32',
45 'os2' => 'Win32',
46 'mswin32' => 'Win32',
47 'netware' => 'Win32',
48 'cygwin' => 'Win32',
49  
50 # Mac family OSes
51 'macos' => 'Mac',
52 'rhapsody' => 'Mac',
53 'darwin' => 'Mac',
54  
55 # Other OSes
56 'vms' => 'Linux',
57 'vos' => 'Linux',
58 'os390' => 'Linux',
59 'vmesa' => 'Linux',
60 'riscos' => 'Linux',
61 'amigaos' => 'Linux',
62 'beos' => 'Linux',
63 'machten' => 'Linux',
64 'mpeix' => 'Linux',
65 'bitrig' => 'Linux',
66 'minix' => 'Linux',
67 'nto' => 'Linux',
68 );
69  
70 #----------------------------------------------------------------------------
71  
72 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
73 1 my ($class) = @_;
74 1 my $self = {};
75 1 bless $self, $class;
76 1 return $self;
77 }
78  
79 1 ▶sub get_info {
Subroutine get_info: called CC=3 SCAR=11.0
Pod documented
80 1 my $self = shift;
81 1 my $data;
82  
83 1 ▶ my $plugin = $map{ lc $^O } || 'Linux';
Condition50%1/2
$map{lc $^O} || 'Linux'
l!l
10
MC/DC0%0/1
$map{lc $^O} || 'Linux'
$map{lc $^O}
Truth table50%1/2
A
A= $map{lc $^O}
Aresult
11
00
84  
85 1 my $driver = 'Devel::Platform::Info::' . $plugin;
86 1 my $require = "$driver.pm";
87 1 $require =~ s!::!/!g;
88  
89 1 eval {
90 1 require $require;
91 1 $self->{driver} = $driver->new();
92 1 $data = $self->{driver}->get_info();
93 };
94  
95 1 ▶ $data->{error} = $@ if($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
96  
97 1 return $data;
98 }
99  
100 6 1;
101  
102 __END__
« Info/Mac.pm ↑ Summary