ReadLine/Demo.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 40 CC 2 SCAR 11.5
CC
2
Cov
0%
demo
6.0
BEGIN
2.0
getopt
2.0
CRAP 3.1
1 package App::Rad::Plugin::ReadLine::Demo;
2 BEGIN {
3 $App::Rad::Plugin::ReadLine::Demo::VERSION = '0.003'; # TRIAL
4 }
5 # ABSTRACT: export &demo into your App::Rad app, so you can use ExampleRunner in the pod
6  
7  
8 our @EXPORT_OK = ('&demo', '&getopt');
9 use base Exporter;
10  
11  
12 sub demo # : Help('run shell commands from @ARGV')
13 {
14 my $c=shift;
15 no warnings qw[ redefine ];
16 my @answers = (@ARGV, qw[ exit ]);
17 *Term::UI::get_reply = sub {
18 my $self= shift;
19 my %args = @_;
20 my $answer = shift @answers;
21 print $args{prompt},$answer, "\n";
22 $answer;
23 };
24 if (@answers) {
25 local $c->{'cmd'} = shift @answers;
26 $c->execute();
27 }
28 else {
29 $c->shell();
30 }
31 ''
32 }
33  
34 sub getopt
35 #:Help('see what getopt makes of commands')
36 {
37 my $c = shift;
38 use Data::Dumper;
39 Data::Dumper->Dump(
40 [ $c->options, $c->argv, \@ARGV ],
41 [qw( $c->options $c->argv @ARGV)]
42 );
43 }
44  
45  
46  
47 __END__