| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::CLI::Interact::Transport::Wrapper::Net_Telnet; |
|
2
|
|
|
|
|
|
|
{ $Net::CLI::Interact::Transport::Wrapper::Net_Telnet::VERSION = '2.300005' } |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6856
|
use Moo; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
1
|
|
|
1
|
|
315
|
use Sub::Quote; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
60
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use MooX::Types::MooseLike::Base qw(Str InstanceOf); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
80
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'Net::CLI::Interact::Transport::Wrapper::Base'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
{ |
|
11
|
|
|
|
|
|
|
package # hide from pause |
|
12
|
|
|
|
|
|
|
Net::CLI::Interact::Transport::Wrapper::Options; |
|
13
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
|
1
|
|
|
|
|
9
|
|
|
|
1
|
|
|
|
|
8
|
|
|
14
|
|
|
|
|
|
|
extends 'Net::CLI::Interact::Transport::Wrapper::Base::Options'; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
0
|
0
|
0
|
sub put { (shift)->wrapper->put( join '', @_ ) } |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has '_buffer' => ( |
|
20
|
|
|
|
|
|
|
is => 'rw', |
|
21
|
|
|
|
|
|
|
isa => Str, |
|
22
|
|
|
|
|
|
|
default => quote_sub(q{''}), |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub buffer { |
|
26
|
4
|
|
|
4
|
0
|
11
|
my $self = shift; |
|
27
|
4
|
100
|
|
|
|
47
|
return $self->_buffer if scalar(@_) == 0; |
|
28
|
2
|
|
|
|
|
34
|
return $self->_buffer(shift); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub pump { |
|
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
33
|
0
|
|
|
|
|
|
my $content = $self->wrapper->get(Timeout => $self->timeout); |
|
34
|
0
|
0
|
|
|
|
|
$self->_buffer($self->_buffer . $content) if defined $content; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has '+timeout' => ( |
|
38
|
|
|
|
|
|
|
trigger => 1, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _trigger_timeout { |
|
42
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
43
|
0
|
0
|
|
|
|
|
if (scalar @_) { |
|
44
|
0
|
|
|
|
|
|
my $timeout = shift; |
|
45
|
0
|
0
|
|
|
|
|
if ($self->connect_ready) { |
|
46
|
0
|
|
|
|
|
|
$self->wrapper->timeout($timeout); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has '+wrapper' => ( |
|
52
|
|
|
|
|
|
|
isa => InstanceOf['Net::Telnet'], |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
around '_build_wrapper' => sub { |
|
56
|
|
|
|
|
|
|
my ($orig, $self) = (shift, shift); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$self->logger->log('transport', 'notice', 'creating Net::Telnet wrapper for', $self->app); |
|
59
|
|
|
|
|
|
|
$self->$orig(@_); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$SIG{CHLD} = 'IGNORE' |
|
62
|
|
|
|
|
|
|
if not $self->connect_options->reap; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
with 'Net::CLI::Interact::Transport::Role::ConnectCore'; |
|
65
|
|
|
|
|
|
|
return $self->connect_core($self->app, $self->runtime_options); |
|
66
|
|
|
|
|
|
|
}; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
after 'disconnect' => sub { |
|
69
|
|
|
|
|
|
|
delete $SIG{CHLD}; |
|
70
|
|
|
|
|
|
|
}; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |