| 1 | package Linux::Event::_IO; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 134 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 134 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 134 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 134 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub _constructor_handles ($method, $option) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_constructor_handles: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my $fh = $option->{fh}; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | my $read_fh = $option->{read_fh}; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | my $write_fh = $option->{write_fh}; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | croak "$method(): fh cannot be combined with read_fh or write_fh" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $fh and defined $read_fh || defined $write_fh
defined $read_fh or defined $write_fh
MC/DC0%0/3
defined $fh and defined $read_fh || defined $write_fh
defined $fh
defined $read_fh
defined $write_fh
Truth table0%0/4
A and B or C
A= defined $fhB= defined $read_fhC= defined $write_fh
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | if defined($fh) && (defined($read_fh) || defined($write_fh)); | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if (defined $fh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | $read_fh = $fh; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $write_fh = $fh; | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my @handle; | |||||||||||||||||||||||||||||||||||||||||
| 22 | my %seen; | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | for my $pair ([read_fh => $read_fh], [write_fh => $write_fh]) { | |||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | next if !defined $pair->[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my $fd = fileno($pair->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | croak "$method(): $pair->[0] must be a filehandle" if !defined $fd; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | next if $seen{$fd}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | push @handle, [$pair->[0], $pair->[1], $fd]; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | return @handle; | |||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 304 | ▶ | sub _transition_resource_kind ($target) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_transition_resource_kind: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 304 | ▶ | return 'pipe' if $target->isa('Linux::Event::IO::Pipe'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 296 | ▶ | return 'tty' if $target->isa('Linux::Event::IO::TTY'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 290 | ▶ | return 'stream-socket' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | if $target->isa('Linux::Event::IO::Sock::Stream'); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 153 | ▶ | sub _guard_transition_resource_kind ($self, $class) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_guard_transition_resource_kind: called CC=8 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 153 | ▶ | return if !defined($class) || ref($class) || $class eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $class or ref $class or $class eq ""
not defined $class or ref $class
MC/DC0%0/3
not defined $class or ref $class or $class eq ""
not defined $class
ref $class
$class eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $classB= ref $classC= $class eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 153 | my $source_kind = _transition_resource_kind($self); | |||||||||||||||||||||||||||||||||||||||||
| 45 | 153 | ▶ | return if !defined $source_kind; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 151 | my $target_kind = _transition_resource_kind($class); | |||||||||||||||||||||||||||||||||||||||||
| 48 | 151 | ▶ | croak 'transition_to(): cannot change ordered-byte resource kind (' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not defined $target_kind or $source_kind ne $target_kind
MC/DC50%1/2
not defined $target_kind or $source_kind ne $target_kind
not defined $target_kind
$source_kind ne $target_kind
Truth table66%2/3
not(A) or B
A= not defined $target_kindB= $source_kind ne $target_kind
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | . $source_kind . ' -> ' | ||||||||||||||||||||||||||||||||||||||||||
| 50 | . (defined($target_kind) ? $target_kind : 'other') . ')' | ||||||||||||||||||||||||||||||||||||||||||
| 51 | if !defined($target_kind) || $source_kind ne $target_kind; | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 143 | return; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 134 | 1; | |||||||||||||||||||||||||||||||||||||||||