Interact/Transport/Loopback.pm

filter: Statementstmt 85.7% 12 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod n/a totaltotal 80.0% 16 / 20 CC 1 SCAR 2.9
CC
1
Cov
86%
_build_app
2.0
runtime_options
2.0
BEGIN
1.0
CRAP 1.3
« Interact/Transport/Net_OpenSSH.pm ↑ Summary Interact/Transport/Role/ConnectCore.pm »
1 package Net::CLI::Interact::Transport::Loopback;
2 $Net::CLI::Interact::Transport::Loopback::VERSION = '2.400001';
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Sub::Quote;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use MooX::Types::MooseLike::Base qw(InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶sub _build_app { return $^X }
Subroutine _build_app: not called CC=1 SCAR=6.9
38  
39 sub runtime_options {
40 0 ▶ return ('-ne', 'BEGIN { $| = 1 }; print $_, time, "\nPROMPT> ";');
Subroutine runtime_options: not called CC=1 SCAR=6.9
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  
« Interact/Transport/Net_OpenSSH.pm ↑ Summary Interact/Transport/Role/ConnectCore.pm »