blib/lib/Linux/Event/IO/TTY.pm

filter: Statementstmt 100% 25 / 25 Branchbran 85.7% 12 / 14 Conditioncond 66.6% 8 / 12 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 83.5% 56 / 67 CC 12 SCAR 21.8
CC
12
Cov
88%
new
12.8
BEGIN
1.0
BEGIN
1.0
CRAP 8.9
« bench/run-stream-microbench.pl ↑ Summary blib/lib/Linux/Event/Kernel/Signal.pm »
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
BranchTrueFalseTotal
exists $option{'owns_handles'} ? : 2 9 11
14 11 ▶ croak 'new(): owns_handles must be zero or one'
Branch: 1 branch
BranchTrueFalseTotal
if not defined $owns_handles or ref $owns_handles or not $owns_handles =~ /\A[01]\z/u 1 10 11
Condition50%3/6
not defined $owns_handles or ref $owns_handles or not $owns_handles =~ /\A[01]\z/u
l!l&&r!l&&!r
0110
not defined $owns_handles or ref $owns_handles
l!l&&r!l&&!r
0011
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
ABCresult
1XX1
01X1
0011
0000
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
BranchTrueFalseTotal
if (defined(my $fh = $option{'fh'})) { } 7 3 10
19 7 ▶ croak 'new(): fh is not a TTY or PTY' if !-t $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless -t $fh 0 7 7
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
BranchTrueFalseTotal
if defined $option{"read_fh"} and not -t $option{"read_fh"} 1 2 3
Condition100%3/3
defined $option{"read_fh"} and not -t $option{"read_fh"}
!ll&&!rl&&r
111
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"}
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if defined $option{"write_fh"} and not -t $option{"write_fh"} 0 2 2
Condition66%2/3
defined $option{"write_fh"} and not -t $option{"write_fh"}
!ll&&!rl&&r
110
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"}
ABresult
0X0
100
111
25 }
26  
27 9 ▶ $option{_owns_handles} = $owns_handles ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$owns_handles ? : 1 8 9
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__
« bench/run-stream-microbench.pl ↑ Summary blib/lib/Linux/Event/Kernel/Signal.pm »