line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::CLI::Interact::Transport::Loopback; |
2
|
|
|
|
|
|
|
{ $Net::CLI::Interact::Transport::Loopback::VERSION = '2.400000' } |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
710
|
use Moo; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
11
|
|
5
|
1
|
|
|
1
|
|
409
|
use Sub::Quote; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
88
|
|
6
|
1
|
|
|
1
|
|
7
|
use MooX::Types::MooseLike::Base qw(InstanceOf); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
81
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'Net::CLI::Interact::Transport::Base'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
package # hide from pause |
12
|
|
|
|
|
|
|
Net::CLI::Interact::Transport::Loopback::Options; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
15
|
|
|
|
|
|
|
extends 'Net::CLI::Interact::Transport::Options'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'connect_options' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => InstanceOf['Net::CLI::Interact::Transport::Loopback::Options'], |
23
|
|
|
|
|
|
|
default => sub { {} }, |
24
|
|
|
|
|
|
|
coerce => quote_sub( |
25
|
|
|
|
|
|
|
q{ Net::CLI::Interact::Transport::Loopback::Options->new(@_) if ref '' ne ref $_[0] }), |
26
|
|
|
|
|
|
|
required => 1, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#sub _which_perl { |
30
|
|
|
|
|
|
|
# use Config; |
31
|
|
|
|
|
|
|
# $secure_perl_path = $Config{perlpath}; |
32
|
|
|
|
|
|
|
# if ($^O ne 'VMS') |
33
|
|
|
|
|
|
|
# {$secure_perl_path .= $Config{_exe} |
34
|
|
|
|
|
|
|
# unless $secure_perl_path =~ m/$Config{_exe}$/i;} |
35
|
|
|
|
|
|
|
# return $secure_perl_path; |
36
|
|
|
|
|
|
|
#} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
|
|
sub _build_app { return $^X } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub runtime_options { |
41
|
0
|
|
|
0
|
1
|
|
return ('-ne', 'BEGIN { $| = 1 }; print $_, time, "\nPROMPT> ";'); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Net::CLI::Interact::Transport::Loopback - Testable CLI connection |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DECRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This module provides a wrapped instance of Perl which simply echoes back any |
55
|
|
|
|
|
|
|
input provided. This is used for the L<Net::CLI::Interact> test suite. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 INTERFACE |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 app |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Defaults to the value of C<$^X> (that is, Perl itself). |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 runtime_options |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Returns Perl options which turn it into a CLI emulator: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
-ne 'BEGIN { $| = 1 }; print $_, time, "\nPROMPT>\n";' |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
For example: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
some command |
72
|
|
|
|
|
|
|
some command |
73
|
|
|
|
|
|
|
1301578196 |
74
|
|
|
|
|
|
|
PROMPT> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
In this case the output command was "some command" which was echoed, followed |
77
|
|
|
|
|
|
|
by the dummy command output (epoch seconds), followed by a "prompt". |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COMPOSITION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
See the following for further interface details: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L<Net::CLI::Interact::Transport::Base> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|