blib/lib/IPC/Run/Fused/POSIX.pm

filter: Statementstmt 82.3% 28 / 34 Branchbran 50.0% 8 / 16 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 68.6% 46 / 67 SCAR 26.7
CC
11
Cov
70%
run_fused
17.7
_fail
2.0
BEGIN
1.0
CRAP 14.4
« blib/lib/IPC/Run/Fused/Win32.pm ↑ Summary Build »
1  
2 306 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 306 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package IPC::Run::Fused::POSIX;
6 BEGIN {
7 306 ▶ $IPC::Run::Fused::POSIX::AUTHORITY = 'cpan:KENTNL';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 }
9 {
10 306 $IPC::Run::Fused::POSIX::VERSION = '0.04000100';
11 }
12  
13 306 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # ABSTRACT: Implementation of IPC::Run::Fused for POSIX-ish systems.
16  
17  
18 0 ▶sub _fail { goto \&IPC::Run::Fused::_fail }
Subroutine _fail: not called CC=1 SCAR=6.9
19  
20 sub run_fused {
21 15450 ▶ my ( $read_handle, @params ) = @_;
Subroutine run_fused: called CC=11 SCAR=28.7
Pod documented
22  
23 15450 my ( $reader, $writer );
24  
25 15450 ▶ pipe( $reader, $writer ) or _fail('Creating Pipe');
Branch: 1 branch
BranchTrueFalseTotal
pipe $reader, $writer or _fail("Creating Pipe") 0 15450 15450
26  
27 15450 ▶ if ( my $pid = fork() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $pid = fork) 15150 300 15450
28 15150 $_[0] = $reader;
29 15150 return $pid;
30 }
31  
32 300 ▶ open *STDOUT, '>>&=', $writer->fileno or _fail('Assigning to STDOUT');
Branch: 1 branch
BranchTrueFalseTotal
open *STDOUT, ">>&=", $writer->fileno or _fail("Assigning to STDOUT") 0 300 300
33 300 ▶ open *STDERR, '>>&=', $writer->fileno or _fail('Assigning to STDERR');
Branch: 1 branch
BranchTrueFalseTotal
open *STDERR, ">>&=", $writer->fileno or _fail("Assigning to STDERR") 0 300 300
34  
35 300 ▶ if ( ref $params[0] and ref $params[0] eq 'CODE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params[0] and ref $params[0] eq "CODE") 100 200 300
Condition66%2/3
ref $params[0] and ref $params[0] eq "CODE"
!ll&&!rl&&r
2000100
MC/DC50%1/2
ref $params[0] and ref $params[0] eq "CODE"
ref $params[0] ref $params[0] eq "CODE"
Truth table66%2/3
A and B
A= ref $params[0]B= ref $params[0] eq "CODE"
ABresult
0X0
100
111
36 100 $params[0]->();
37 100 exit;
38 }
39 200 ▶ if ( ref $params[0] and ref $params[0] eq 'SCALAR' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params[0] and ref $params[0] eq "SCALAR") 0 200 200
Condition33%1/3
ref $params[0] and ref $params[0] eq "SCALAR"
!ll&&!rl&&r
20000
MC/DC0%0/2
ref $params[0] and ref $params[0] eq "SCALAR"
ref $params[0] ref $params[0] eq "SCALAR"
Truth table33%1/3
A and B
A= ref $params[0]B= ref $params[0] eq "SCALAR"
ABresult
0X0
100
111
40 0 my $command = ${ $params[0] };
41 0 ▶ exec $command or _fail('<<exec command>> failed');
Branch: 1 branch
BranchTrueFalseTotal
exec $command or _fail("<<exec command>> failed") 0 0 0
42 0 exit;
43 }
44  
45 200 my $program = $params[0];
46 200 ▶ exec {$program} @params or _fail('<<exec {program} @argv>> failed');
Branch: 1 branch
BranchTrueFalseTotal
exec {$program;} @params or _fail("<<exec {program} \@argv>> failed") 0 0 0
47 0 exit;
48 }
49  
50 306 1;
51  
52 __END__
« blib/lib/IPC/Run/Fused/Win32.pm ↑ Summary Build »