| 1 | 3 | ▶ | use strict; use warnings; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 2 | package IO::All::Pipe; | ||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||
| 4 | 3 | ▶ | use IO::All -base; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 5 | 3 | ▶ | use IO::File; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||
| 7 | 3 | const type => 'pipe'; | |||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||
| 9 | sub pipe { | ||||||||||||||||||||||||
| 10 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||
|
Subroutine
pipe: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||
| 11 | 2 | bless $self, __PACKAGE__; | |||||||||||||||||||||||
| 12 | 2 | ▶ | $self->name(shift) if @_; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 13 | 2 | return $self->_init; | |||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||
| 16 | sub _assert_open { | ||||||||||||||||||||||||
| 17 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||
|
Subroutine
_assert_open: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||
| 18 | 2 | ▶ | return if $self->is_open; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 19 | 2 | ▶ | $self->mode(shift) unless $self->mode; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 20 | 2 | $self->open; | |||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||
| 23 | sub open { | ||||||||||||||||||||||||
| 24 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||
|
Subroutine
open: called CC=6 SCAR=19.2
Pod
documented
| |||||||||||||||||||||||||
| 25 | 2 | $self->is_open(1); | |||||||||||||||||||||||
| 26 | 2 | require IO::Handle; | |||||||||||||||||||||||
| 27 | 2 | ▶ | $self->io_handle(IO::Handle->new) | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 28 | unless defined $self->io_handle; | ||||||||||||||||||||||||
| 29 | 2 | my $command = $self->name; | |||||||||||||||||||||||
| 30 | 2 | $command =~ s/(^\||\|$)//; | |||||||||||||||||||||||
| 31 | 2 | ▶ | my $mode = shift || $self->mode || '<'; | ||||||||||||||||||||||
|
Condition40%2/5
shift() || $self->mode || '<'
shift() or $self->mode
MC/DC0%0/2
shift() || $self->mode || '<'
shift()
$self->mode
Truth table33%1/3
A or B
A= shift()B= $self->mode
| |||||||||||||||||||||||||
| 32 | 2 | ▶ | my $pipe_mode = | ||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||
| 33 | $mode eq '>' ? '|-' : | ||||||||||||||||||||||||
| 34 | $mode eq '<' ? '-|' : | ||||||||||||||||||||||||
| 35 | $self->throw("Invalid usage mode '$mode' for pipe"); | ||||||||||||||||||||||||
| 36 | 2 | CORE::open($self->io_handle, $pipe_mode, $command); | |||||||||||||||||||||||
| 37 | 2 | $self->_set_binmode; | |||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||
| 40 | 3 | my %mode_msg = ( | |||||||||||||||||||||||
| 41 | '>' => 'output', | ||||||||||||||||||||||||
| 42 | '<' => 'input', | ||||||||||||||||||||||||
| 43 | '>>' => 'append', | ||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||
| 45 | sub open_msg { | ||||||||||||||||||||||||
| 46 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||
|
Subroutine
open_msg: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||
| 47 | 0 | ▶ | my $name = defined $self->name | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 48 | ? " '" . $self->name . "'" | ||||||||||||||||||||||||
| 49 | : ''; | ||||||||||||||||||||||||
| 50 | my $direction = defined $mode_msg{$self->mode} | ||||||||||||||||||||||||
| 51 | 0 | ▶ | ? ' for ' . $mode_msg{$self->mode} | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 52 | : ''; | ||||||||||||||||||||||||
| 53 | 0 | return qq{Can't open pipe$name$direction:\n$!}; | |||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||
| 56 | 3 | 1; | |||||||||||||||||||||||