lib/IPC/Run/Fused/POSIX.pm

filter: Statementstmt 88.1% 37 / 42 Branchbran 50.0% 8 / 16 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 75.0% 57 / 76 SCAR 25.6
CC
11
Cov
75%
run_fused
17.2
BEGIN
1.0
BEGIN
1.0
CRAP 12.9
« blib/lib/IPC/Run/Fused/POSIX.pm ↑ Summary blib/lib/IPC/Run/Fused.pm »
1 304 ▶use 5.008003;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 304 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 304 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package IPC::Run::Fused::POSIX;
6  
7 304 our $VERSION = '1.000000';
8  
9 # ABSTRACT: Implementation of IPC::Run::Fused for POSIX-ish systems.
10  
11 304 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13 304 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39 304 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
40 304 ▶use IPC::Run::Fused qw( _fail );
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 304 our @EXPORT_OK = qw( run_fused );
43  
44 sub run_fused { ## no critic ( Subroutines::RequireArgUnpacking )
45  
46 15450 ▶ my ( $read_handle, @params ) = ( \shift @_, @_ );
Subroutine run_fused: called CC=11 SCAR=28.5
Pod documented
47  
48 15450 my ( $reader, $writer );
49  
50 15450 ▶ pipe $reader, $writer or _fail('Creating Pipe');
Branch: 1 branch
BranchTrueFalseTotal
pipe $reader, $writer or _fail("Creating Pipe") 0 15450 15450
51  
52 15450 ▶ if ( my $pid = fork ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $pid = fork) 15150 300 15450
53 15150 ${$read_handle} = $reader;
54 15150 return $pid;
55 }
56  
57 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
58 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
59  
60 300 ▶ if ( ref $params[0] and 'CODE' eq ref $params[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params[0] and "CODE" eq ref $params[0]) 100 200 300
Condition66%2/3
ref $params[0] and "CODE" eq ref $params[0]
!ll&&!rl&&r
2000100
MC/DC50%1/2
ref $params[0] and "CODE" eq ref $params[0]
ref $params[0] "CODE" eq ref $params[0]
Truth table66%2/3
A and B
A= ref $params[0]B= "CODE" eq ref $params[0]
ABresult
0X0
100
111
61 100 $params[0]->();
62 100 exit;
63 }
64 200 ▶ if ( ref $params[0] and 'SCALAR' eq ref $params[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params[0] and "SCALAR" eq ref $params[0]) 0 200 200
Condition33%1/3
ref $params[0] and "SCALAR" eq ref $params[0]
!ll&&!rl&&r
20000
MC/DC0%0/2
ref $params[0] and "SCALAR" eq ref $params[0]
ref $params[0] "SCALAR" eq ref $params[0]
Truth table33%1/3
A and B
A= ref $params[0]B= "SCALAR" eq ref $params[0]
ABresult
0X0
100
111
65 0 my $command = ${ $params[0] };
66 0 ▶ exec $command or _fail('<<exec command>> failed');
Branch: 1 branch
BranchTrueFalseTotal
exec $command or _fail("<<exec command>> failed") 0 0 0
67 0 exit;
68 }
69  
70 200 my $program = $params[0];
71 ## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars)
72 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
73 0 exit;
74 }
75  
76 304 1;
77  
78 __END__
« blib/lib/IPC/Run/Fused/POSIX.pm ↑ Summary blib/lib/IPC/Run/Fused.pm »