| 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
| |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if (length $self->{buffer}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 0 | my @line = $self->get; | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | if (length $self->{buffer} and $self->{buffer} ne "\x0d") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $self->{"buffer"} and $self->{"buffer"} ne "\r"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 35 | 0 | my $line = $1; | |||||||||||||||||||||||||||
| 36 | 0 | ▶ | next if $line eq "\x0d"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | $line =~ s/[\x0d\x0a]+\z//; | |||||||||||||||||||||||||||
| 38 | 0 | push @line, $line; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 0 | return @line; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 1 | 1; | |||||||||||||||||||||||||||