line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
304
|
|
|
304
|
|
2083
|
use strict; |
|
304
|
|
|
|
|
508
|
|
|
304
|
|
|
|
|
11899
|
|
3
|
304
|
|
|
304
|
|
1624
|
use warnings; |
|
304
|
|
|
|
|
406
|
|
|
304
|
|
|
|
|
14094
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package IPC::Run::Fused::POSIX; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
304
|
|
|
304
|
|
9012
|
$IPC::Run::Fused::POSIX::AUTHORITY = 'cpan:KENTNL'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
|
$IPC::Run::Fused::POSIX::VERSION = '0.04000100'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
304
|
|
|
304
|
|
403104
|
use IO::Handle; |
|
304
|
|
|
|
|
3282557
|
|
|
304
|
|
|
|
|
101276
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Implementation of IPC::Run::Fused for POSIX-ish systems. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
|
0
|
sub _fail { goto \&IPC::Run::Fused::_fail } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub run_fused { |
21
|
15450
|
|
|
15450
|
1
|
6725898748
|
my ( $read_handle, @params ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
15450
|
|
|
|
|
45162
|
my ( $reader, $writer ); |
24
|
|
|
|
|
|
|
|
25
|
15450
|
50
|
|
|
|
931690
|
pipe( $reader, $writer ) or _fail('Creating Pipe'); |
26
|
|
|
|
|
|
|
|
27
|
15450
|
100
|
|
|
|
33034985
|
if ( my $pid = fork() ) { |
28
|
15150
|
|
|
|
|
616444
|
$_[0] = $reader; |
29
|
15150
|
|
|
|
|
4441378
|
return $pid; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
300
|
50
|
|
|
|
167346
|
open *STDOUT, '>>&=', $writer->fileno or _fail('Assigning to STDOUT'); |
33
|
300
|
50
|
|
|
|
145248
|
open *STDERR, '>>&=', $writer->fileno or _fail('Assigning to STDERR'); |
34
|
|
|
|
|
|
|
|
35
|
300
|
100
|
66
|
|
|
67021
|
if ( ref $params[0] and ref $params[0] eq 'CODE' ) { |
36
|
100
|
|
|
|
|
5356
|
$params[0]->(); |
37
|
100
|
|
|
|
|
343155
|
exit; |
38
|
|
|
|
|
|
|
} |
39
|
200
|
50
|
33
|
|
|
8003
|
if ( ref $params[0] and ref $params[0] eq 'SCALAR' ) { |
40
|
0
|
|
|
|
|
0
|
my $command = ${ $params[0] }; |
|
0
|
|
|
|
|
0
|
|
41
|
0
|
0
|
|
|
|
0
|
exec $command or _fail('<> failed'); |
42
|
0
|
|
|
|
|
0
|
exit; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
200
|
|
|
|
|
4610
|
my $program = $params[0]; |
46
|
200
|
0
|
|
|
|
3551
|
exec {$program} @params or _fail('<> failed'); |
|
200
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
exit; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |