| 1 | package Linux::Event::IO::Pipe; | ||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use v5.36; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 10 | our $VERSION = '0.120'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use parent 'Linux::Event::_ByteStream'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # Linux fcntl.h: F_LINUX_SPECIFIC_BASE + 8. Linux::Event is Linux-only and | ||||||||||||||||||||||||||||
| 12 | # F_GETPIPE_SZ succeeds only for pipe/FIFO descriptors, so this avoids the | ||||||||||||||||||||||||||||
| 13 | # heavier stat-backed -p file test while preserving the concrete leaf contract. | ||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use constant _F_GETPIPE_SZ => 1032; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 11 | ▶ | sub _is_pipe ($fh) { | ||||||||||||||||||||||||||
|
Subroutine
_is_pipe: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 11 | return defined fcntl($fh, _F_GETPIPE_SZ, 0); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 11 | ▶ | sub new ($class, %option) { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=20.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | 11 | ▶ | if (defined(my $fh = $option{fh})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | croak 'new(): fh is not a pipe or FIFO' if !_is_pipe($fh); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | } else { | ||||||||||||||||||||||||||||
| 24 | croak 'new(): read_fh is not a pipe or FIFO' | ||||||||||||||||||||||||||||
| 25 | 10 | ▶ | if defined($option{read_fh}) && !_is_pipe($option{read_fh}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $option{"read_fh"} and not _is_pipe($option{"read_fh"})
MC/DC50%1/2
defined $option{"read_fh"} and not _is_pipe($option{"read_fh"})
defined $option{"read_fh"}
not _is_pipe($option{"read_fh"})
Truth table66%2/3
A and not(B)
A= defined $option{"read_fh"}B= not _is_pipe($option{"read_fh"})
| |||||||||||||||||||||||||||||
| 26 | croak 'new(): write_fh is not a pipe or FIFO' | ||||||||||||||||||||||||||||
| 27 | 9 | ▶ | if defined($option{write_fh}) && !_is_pipe($option{write_fh}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $option{"write_fh"} and not _is_pipe($option{"write_fh"})
MC/DC0%0/2
defined $option{"write_fh"} and not _is_pipe($option{"write_fh"})
defined $option{"write_fh"}
not _is_pipe($option{"write_fh"})
Truth table33%1/3
A and not(B)
A= defined $option{"write_fh"}B= not _is_pipe($option{"write_fh"})
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 9 | return $class->SUPER::new(%option); | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 10 | 1; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||||||||||