RemoteCommand/LineBuffer.pm

filter: Statementstmt 30.0% 9 / 30 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 21.4% 12 / 56 CC 8 SCAR 37.3
CC
8
Cov
21%
get
72.0
new
2.0
raw
2.0
CRAP 41.8
« RemoteCommand.pm ↑ Summary RemoteCommand/Select.pm »
1 package App::RemoteCommand::LineBuffer;
2 1 ▶use v5.24;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental qw(lexical_subs signatures);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new ($class) {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
7 0 bless { buffer => "" }, $class;
8 }
9  
10 0 ▶sub raw ($self) {
Subroutine raw: not called CC=1 SCAR=6.9
Pod undocumented
11 0 $self->{buffer};
12 }
13  
14 0 ▶sub add ($self, $buffer) {
Subroutine add: not called CC=1 SCAR=6.9
Pod undocumented
15 0 $self->{buffer} .= $buffer;
16 0 $self;
17 }
18  
19 0 ▶sub get ($self, $drain = undef) {
Subroutine get: not called CC=8 SCAR=42.8
Pod undocumented
20 0 ▶ if ($drain) {
Branch: 1 branch
BranchTrueFalseTotal
if ($drain) 0 0 0
21 0 ▶ if (length $self->{buffer}) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->{'buffer'}) { } 0 0 0
22 0 my @line = $self->get;
23 0 ▶ if (length $self->{buffer} and $self->{buffer} ne "\x0d") {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->{"buffer"} and $self->{"buffer"} ne "\r") 0 0 0
Condition0%0/3
length $self->{"buffer"} and $self->{"buffer"} ne "\r"
!ll&&!rl&&r
000
MC/DC0%0/2
length $self->{"buffer"} and $self->{"buffer"} ne "\r"
length $self->{"buffer"} $self->{"buffer"} ne "\r"
Truth table0%0/3
A and B
A= length $self->{"buffer"}B= $self->{"buffer"} ne "\r"
ABresult
0X0
100
111
24 0 $self->{buffer} =~ s/[\x0d\x0a]+\z//;
25 0 push @line, $self->{buffer};
26 }
27 0 $self->{buffer} = "";
28 0 return @line;
29 } else {
30 0 return;
31 }
32 }
33 0 my @line;
34 0 ▶ while ($self->{buffer} =~ s/\A(.*?(?:\x0d\x0a|\x0d|\x0a))//sm) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"buffer"} =~ s/\A(.*?(?:\x0d\x0a|\x0d|\x0a))//msu) 0 0 0
35 0 my $line = $1;
36 0 ▶ next if $line eq "\x0d";
Branch: 1 branch
BranchTrueFalseTotal
if $line eq "\r" 0 0 0
37 0 $line =~ s/[\x0d\x0a]+\z//;
38 0 push @line, $line;
39 }
40 0 return @line;
41 }
42  
43 1 1;
« RemoteCommand.pm ↑ Summary RemoteCommand/Select.pm »