blib/lib/Shell/Command.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 75.0% 6 / 8 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 88.3% 53 / 60 CC 7 SCAR 10.5
CC
7
Cov
90%
__ANON__
5.4
__ANON__
3.0
BEGIN
1.0
CRAP 2.9
↑ Summary
1 package Shell::Command;
2 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 $Shell::Command::AUTHORITY = 'cpan:FLORA';
4 }
5 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 $Shell::Command::VERSION = '0.06';
7 }
8 # ABSTRACT: Cross-platform functions emulating common shell commands
9  
10 # This must come first before ExtUtils::Command is loaded to ensure it
11 # takes effect.
12 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶ *CORE::GLOBAL::exit = sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
14 4 ▶ CORE::exit($_[0]) unless caller eq 'ExtUtils::Command';
Branch: 1 branch
BranchTrueFalseTotal
unless caller eq "ExtUtils::Command" 1 3 4
15  
16 3 ▶ my $exit = $_[0] || 0;
Condition100%2/2
$_[0] || 0
l!l
21
MC/DC100%1/1
$_[0] || 0
$_[0]
Truth table100%2/2
A
A= $_[0]
Aresult
11
00
17 3 die "exit: $exit\n";
18 2 };
19 }
20  
21 2 ▶use ExtUtils::Command ();
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 @ISA = qw(Exporter);
25 2 @EXPORT = @ExtUtils::Command::EXPORT;
26 2 @EXPORT_OK = @ExtUtils::Command::EXPORT_OK;
27  
28  
29 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 2 foreach my $func (@ExtUtils::Command::EXPORT,
32 @ExtUtils::Command::EXPORT_OK)
33 {
34 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
35 24 ▶ *{$func} = sub {
Subroutine __ANON__: called CC=5 SCAR=16.8
36 5 local @ARGV = @_;
37  
38 5 my $ret;
39 5 eval {
40 5 $ret = &{'ExtUtils::Command::'.$func};
41 };
42 5 ▶ if( $@ =~ /^exit: (\d+)\n$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($@ =~ /^exit: (\d+)\n$/) { } 3 2 5
elsif ($@) { } 0 2 2
43 3 $ret = !$1;
44 }
45 elsif( $@ ) {
46 0 die $@;
47 }
48 else {
49 2 ▶ $ret = 1 unless defined $ret and length $ret;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ret and length $ret 2 0 2
Condition33%1/3
defined $ret and length $ret
!ll&&!rl&&r
020
MC/DC0%0/2
defined $ret and length $ret
defined $ret length $ret
Truth table33%1/3
A and B
A= defined $retB= length $ret
ABresult
0X0
100
111
50 }
51  
52 5 return $ret;
53 24 };
54 }
55  
56  
57 2 1;
58  
59  
60 __END__
↑ Summary