blib/lib/Unix/Process.pm

filter: Statementstmt 97.0% 33 / 34 Branchbran 62.5% 5 / 8 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 85.9% 49 / 57 CC 6 SCAR 10.9
CC
6
Cov
87%
__ANON__
5.3
AUTOLOAD
2.0
BEGIN
1.0
CRAP 3.0
↑ Summary
1 package Unix::Process;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use IPC::System::Simple qw(capturex);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '1.3101';
9 1 ▶our $PS_PROGRAM = $ENV{PS_PATH} || '/bin/ps';
Condition50%1/2
$ENV{'PS_PATH'} || '/bin/ps'
l!l
01
MC/DC0%0/1
$ENV{'PS_PATH'} || '/bin/ps'
$ENV{'PS_PATH'}
Truth table50%1/2
A
A= $ENV{'PS_PATH'}
Aresult
11
00
10 1 our $AUTOLOAD;
11  
12 1 1;
13  
14 2 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
15 2 ▶ die "unprocessable garbage: $AUTOLOAD" unless $AUTOLOAD =~ m/::(\w+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $Unix::Process::AUTOLOAD =~ /::(\w+)$/ 0 2 2
16 2 my $sub = $1;
17  
18 2 ▶ my $f = sub {
Subroutine __ANON__: called CC=5 SCAR=16.7
19 2 my $this = shift;
20 2 ▶ my $pid = shift; $pid = $$ unless $pid and int($pid);
Branch: 1 branch
BranchTrueFalseTotal
unless $pid and int $pid 1 1 2
Condition66%2/3
$pid and int $pid
!ll&&!rl&&r
101
MC/DC50%1/2
$pid and int $pid
$pid int $pid
Truth table66%2/3
A and B
A= $pidB= int $pid
ABresult
0X0
100
111
21 2 my $result = eval { capturex($PS_PROGRAM, '-o', $sub, '-p', $pid) };
22  
23 2 ▶ croak $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
24  
25 2 ▶ return $1 if $result =~ m/[\r\n]\s*(.+?)\s*[\r\n]/ms;
Branch: 1 branch
BranchTrueFalseTotal
if $result =~ /[\r\n]\s*(.+?)\s*[\r\n]/ms 2 0 2
26 0 return;
27 2 };
28  
29 {
30 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 *{$AUTOLOAD} = $f;
32 }
33 2 goto &$f;
34 }
35  
36 __END__
↑ Summary