| 1 | package Net::CLI::Interact::Transport::Loopback; | ||
| 2 | { | ||
| 3 | 1 | $Net::CLI::Interact::Transport::Loopback::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(InstanceOf); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | extends 'Net::CLI::Interact::Transport::Base'; | |
| 11 | |||
| 12 | { | ||
| 13 | 1 | package # hide from pause | |
| 14 | Net::CLI::Interact::Transport::Loopback::Options; | ||
| 15 | |||
| 16 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 1 | extends 'Net::CLI::Interact::Transport::Options'; | |
| 18 | } | ||
| 19 | |||
| 20 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 21 | |||
| 22 | has 'connect_options' => ( | ||
| 23 | is => 'ro', | ||
| 24 | isa => InstanceOf['Net::CLI::Interact::Transport::Loopback::Options'], | ||
| 25 | 2 | ▶ | default => sub { {} }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 26 | 1 | coerce => quote_sub( | |
| 27 | q{ Net::CLI::Interact::Transport::Loopback::Options->new(@_) if ref '' ne ref $_[0] }), | ||
| 28 | required => 1, | ||
| 29 | ); | ||
| 30 | |||
| 31 | #sub _which_perl { | ||
| 32 | # use Config; | ||
| 33 | # $secure_perl_path = $Config{perlpath}; | ||
| 34 | # if ($^O ne 'VMS') | ||
| 35 | # {$secure_perl_path .= $Config{_exe} | ||
| 36 | # unless $secure_perl_path =~ m/$Config{_exe}$/i;} | ||
| 37 | # return $secure_perl_path; | ||
| 38 | #} | ||
| 39 | |||
| 40 | 0 | ▶ | sub _build_app { return $^X } |
|
Subroutine
_build_app: not called CC=1 SCAR=6.9
| |||
| 41 | |||
| 42 | sub runtime_options { | ||
| 43 | 0 | ▶ | return ('-ne', 'BEGIN { $| = 1 }; print $_, time, "\nPROMPT> ";'); |
|
Subroutine
runtime_options: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | } | ||
| 45 | |||
| 46 | 1 | 1; | |
| 47 | |||
| 48 | # ABSTRACT: Testable CLI connection | ||
| 49 | |||
| 50 | |||
| 51 | __END__ | ||
| 52 | =pod | ||
| 53 | |||
| 54 | =head1 NAME | ||
| 55 | |||
| 56 | Net::CLI::Interact::Transport::Loopback - Testable CLI connection | ||
| 57 | |||
| 58 | =head1 VERSION | ||
| 59 | |||
| 60 | version 2.143070 | ||
| 61 | |||
| 62 | =head1 DECRIPTION | ||
| 63 | |||
| 64 | This module provides a wrapped instance of Perl which simply echoes back any | ||
| 65 | input provided. This is used for the L<Net::CLI::Interact> test suite. | ||
| 66 | |||
| 67 | =head1 INTERFACE | ||
| 68 | |||
| 69 | =head2 app | ||
| 70 | |||
| 71 | Defaults to the value of C<$^X> (that is, Perl itself). | ||
| 72 | |||
| 73 | =head2 runtime_options | ||
| 74 | |||
| 75 | Returns Perl options which turn it into a CLI emulator: | ||
| 76 | |||
| 77 | -ne 'BEGIN { $| = 1 }; print $_, time, "\nPROMPT>\n";' | ||
| 78 | |||
| 79 | For example: | ||
| 80 | |||
| 81 | some command | ||
| 82 | some command | ||
| 83 | 1301578196 | ||
| 84 | PROMPT> | ||
| 85 | |||
| 86 | In this case the output command was "some command" which was echoed, followed | ||
| 87 | by the dummy command output (epoch seconds), followed by a "prompt". | ||
| 88 | |||
| 89 | =head1 COMPOSITION | ||
| 90 | |||
| 91 | See the following for further interface details: | ||
| 92 | |||
| 93 | =over 4 | ||
| 94 | |||
| 95 | =item * | ||
| 96 | |||
| 97 | L<Net::CLI::Interact::Transport::Base> | ||
| 98 | |||
| 99 | =back | ||
| 100 | |||
| 101 | =head1 AUTHOR | ||
| 102 | |||
| 103 | Oliver Gorwits <oliver@cpan.org> | ||
| 104 | |||
| 105 | =head1 COPYRIGHT AND LICENSE | ||
| 106 | |||
| 107 | This software is copyright (c) 2014 by Oliver Gorwits. | ||
| 108 | |||
| 109 | This is free software; you can redistribute it and/or modify it under | ||
| 110 | the same terms as the Perl 5 programming language system itself. | ||
| 111 | |||
| 112 | =cut | ||
| 113 | |||