Interact/Transport/Wrapper/Net_Telnet.pm

filter: Statementstmt 64.2% 27 / 42 Branchbran 20.0% 2 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 3 totaltotal 53.8% 35 / 65 CC 6 SCAR 15.5
CC
6
Cov
56%
_trigger_timeout
12.0
pump
6.0
__ANON__
6.0
CRAP 4.7
« Interact.pm ↑ Summary Interact/Role/FindMatch.pm »
1 package Net::CLI::Interact::Transport::Wrapper::Net_Telnet;
2 {
3 1 $Net::CLI::Interact::Transport::Wrapper::Net_Telnet::VERSION = '2.143070';
4 }
5  
6 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Sub::Quote;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooX::Types::MooseLike::Base qw(Str InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 extends 'Net::CLI::Interact::Transport::Wrapper::Base';
11  
12 {
13 1 package # hide from pause
14 Net::CLI::Interact::Transport::Wrapper::Options;
15 1 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 extends 'Net::CLI::Interact::Transport::Wrapper::Base::Options';
17 }
18  
19 0 ▶sub put { (shift)->wrapper->put( join '', @_ ) }
Subroutine put: not called CC=1 SCAR=6.9
Pod undocumented
20  
21 1 has '_buffer' => (
22 is => 'rw',
23 isa => Str,
24 default => quote_sub(q{''}),
25 );
26  
27 sub buffer {
28 4 ▶ my $self = shift;
Subroutine buffer: called CC=2 SCAR=6.9
Pod undocumented
29 4 ▶ return $self->_buffer if scalar(@_) == 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ == 0 2 2 4
30 2 return $self->_buffer(shift);
31 }
32  
33 sub pump {
34 0 ▶ my $self = shift;
Subroutine pump: not called CC=2 SCAR=17.9
Pod undocumented
35 0 my $content = $self->wrapper->get(Timeout => $self->timeout);
36 0 ▶ $self->_buffer($self->_buffer . $content) if defined $content;
Branch: 1 branch
BranchTrueFalseTotal
if defined $content 0 0 0
37 }
38  
39 1 has '+timeout' => (
40 trigger => 1,
41 );
42  
43 sub _trigger_timeout {
44 0 ▶ my $self = shift;
Subroutine _trigger_timeout: not called CC=3 SCAR=24.8
45 0 ▶ if (scalar @_) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_) 0 0 0
46 0 my $timeout = shift;
47 0 ▶ if ($self->connect_ready) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->connect_ready) 0 0 0
48 0 $self->wrapper->timeout($timeout);
49 }
50 }
51 }
52  
53 1 has '+wrapper' => (
54 isa => InstanceOf['Net::Telnet'],
55 );
56  
57 around '_build_wrapper' => sub {
58 0 ▶ my ($orig, $self) = (shift, shift);
Subroutine __ANON__: not called CC=2 SCAR=17.9
59  
60 0 $self->logger->log('transport', 'notice', 'creating Net::Telnet wrapper for', $self->app);
61 0 $self->$orig(@_);
62  
63 0 ▶ $SIG{CHLD} = 'IGNORE'
Branch: 1 branch
BranchTrueFalseTotal
unless $self->connect_options->reap 0 0 0
64 if not $self->connect_options->reap;
65  
66 0 with 'Net::CLI::Interact::Transport::Role::ConnectCore';
67 0 return $self->connect_core($self->app, $self->runtime_options);
68 1 };
69  
70 after 'disconnect' => sub {
71 2 ▶ delete $SIG{CHLD};
Subroutine __ANON__: called CC=1 SCAR=0.0
72 1 };
73  
74 1 1;
« Interact.pm ↑ Summary Interact/Role/FindMatch.pm »