line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1811
|
use strict; use warnings; |
|
3
|
|
|
3
|
|
5
|
|
|
3
|
|
|
|
|
124
|
|
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
152
|
|
2
|
|
|
|
|
|
|
package IO::All::Pipe; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
15
|
use IO::All -base; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
25
|
|
5
|
3
|
|
|
3
|
|
15
|
use IO::File; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
1509
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
const type => 'pipe'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub pipe { |
10
|
2
|
|
|
2
|
1
|
2
|
my $self = shift; |
11
|
2
|
|
|
|
|
4
|
bless $self, __PACKAGE__; |
12
|
2
|
50
|
|
|
|
9
|
$self->name(shift) if @_; |
13
|
2
|
|
|
|
|
9
|
return $self->_init; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _assert_open { |
17
|
2
|
|
|
2
|
|
2
|
my $self = shift; |
18
|
2
|
50
|
|
|
|
8
|
return if $self->is_open; |
19
|
2
|
50
|
|
|
|
7
|
$self->mode(shift) unless $self->mode; |
20
|
2
|
|
|
|
|
5
|
$self->open; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub open { |
24
|
2
|
|
|
2
|
1
|
2
|
my $self = shift; |
25
|
2
|
|
|
|
|
5
|
$self->is_open(1); |
26
|
2
|
|
|
|
|
42
|
require IO::Handle; |
27
|
2
|
50
|
|
|
|
5
|
$self->io_handle(IO::Handle->new) |
28
|
|
|
|
|
|
|
unless defined $self->io_handle; |
29
|
2
|
|
|
|
|
6
|
my $command = $self->name; |
30
|
2
|
|
|
|
|
81
|
$command =~ s/(^\||\|$)//; |
31
|
2
|
|
50
|
|
|
10
|
my $mode = shift || $self->mode || '<'; |
32
|
2
|
50
|
|
|
|
41
|
my $pipe_mode = |
|
|
50
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$mode eq '>' ? '|-' : |
34
|
|
|
|
|
|
|
$mode eq '<' ? '-|' : |
35
|
|
|
|
|
|
|
$self->throw("Invalid usage mode '$mode' for pipe"); |
36
|
2
|
|
|
|
|
4
|
CORE::open($self->io_handle, $pipe_mode, $command); |
37
|
2
|
|
|
|
|
54
|
$self->_set_binmode; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my %mode_msg = ( |
41
|
|
|
|
|
|
|
'>' => 'output', |
42
|
|
|
|
|
|
|
'<' => 'input', |
43
|
|
|
|
|
|
|
'>>' => 'append', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
sub open_msg { |
46
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
47
|
0
|
0
|
|
|
|
|
my $name = defined $self->name |
48
|
|
|
|
|
|
|
? " '" . $self->name . "'" |
49
|
|
|
|
|
|
|
: ''; |
50
|
0
|
0
|
|
|
|
|
my $direction = defined $mode_msg{$self->mode} |
51
|
|
|
|
|
|
|
? ' for ' . $mode_msg{$self->mode} |
52
|
|
|
|
|
|
|
: ''; |
53
|
0
|
|
|
|
|
|
return qq{Can't open pipe$name$direction:\n$!}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |