| 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
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 15450 | ▶ | if ( my $pid = fork() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 15150 | $_[0] = $reader; | |||||||||||||||||||||||||||
| 29 | 15150 | return $pid; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 300 | ▶ | open *STDOUT, '>>&=', $writer->fileno or _fail('Assigning to STDOUT'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 300 | ▶ | open *STDERR, '>>&=', $writer->fileno or _fail('Assigning to STDERR'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 300 | ▶ | if ( ref $params[0] and ref $params[0] eq 'CODE' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $params[0] and ref $params[0] eq "CODE"
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"
| |||||||||||||||||||||||||||||
| 36 | 100 | $params[0]->(); | |||||||||||||||||||||||||||
| 37 | 100 | exit; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 200 | ▶ | if ( ref $params[0] and ref $params[0] eq 'SCALAR' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $params[0] and ref $params[0] eq "SCALAR"
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"
| |||||||||||||||||||||||||||||
| 40 | 0 | my $command = ${ $params[0] }; | |||||||||||||||||||||||||||
| 41 | 0 | ▶ | exec $command or _fail('<<exec command>> failed'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 47 | 0 | exit; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 306 | 1; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||