| 1 | package Linux::Event::IO::TTY; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | our $VERSION = '0.119'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use parent 'Linux::Event::_ByteStream'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 11 | ▶ | sub new ($class, %option) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=12 SCAR=25.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | my $owns_handles = exists($option{owns_handles}) | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 11 | ▶ | ? delete($option{owns_handles}) : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 11 | ▶ | croak 'new(): owns_handles must be zero or one' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not defined $owns_handles or ref $owns_handles or not $owns_handles =~ /\A[01]\z/u
not defined $owns_handles or ref $owns_handles
MC/DC33%1/3
not defined $owns_handles or ref $owns_handles or not $owns_handles =~ /\A[01]\z/u
not defined $owns_handles
ref $owns_handles
not $owns_handles =~ /\A[01]\z/u
Truth table50%2/4
not(A) or B or not(C)
A= not defined $owns_handlesB= ref $owns_handlesC= not $owns_handles =~ /\A[01]\z/u
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | if !defined($owns_handles) || ref($owns_handles) | ||||||||||||||||||||||||||||||||||||||||||
| 16 | || $owns_handles !~ /\A[01]\z/; | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 10 | ▶ | if (defined(my $fh = $option{fh})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | croak 'new(): fh is not a TTY or PTY' if !-t $fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 21 | croak 'new(): read_fh is not a TTY or PTY' | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | ▶ | if defined($option{read_fh}) && !-t $option{read_fh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $option{"read_fh"} and not -t $option{"read_fh"}
MC/DC100%2/2
defined $option{"read_fh"} and not -t $option{"read_fh"}
defined $option{"read_fh"}
not -t $option{"read_fh"}
Truth table100%3/3
A and not(B)
A= defined $option{"read_fh"}B= not -t $option{"read_fh"}
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | croak 'new(): write_fh is not a TTY or PTY' | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | if defined($option{write_fh}) && !-t $option{write_fh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $option{"write_fh"} and not -t $option{"write_fh"}
MC/DC0%0/2
defined $option{"write_fh"} and not -t $option{"write_fh"}
defined $option{"write_fh"}
not -t $option{"write_fh"}
Truth table66%2/3
A and not(B)
A= defined $option{"write_fh"}B= not -t $option{"write_fh"}
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 9 | ▶ | $option{_owns_handles} = $owns_handles ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 9 | return $class->SUPER::new(%option); | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | sub owns_handles ($self) { !!$self->{owns_handles} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
owns_handles: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | __END__ | ||||||||||||||||||||||||||||||||||||||||||