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