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