File Coverage

lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Variables.pm
Criterion Covered Total %
statement 48 48 100.0
branch n/a
condition n/a
subroutine 16 16 100.0
pod n/a
total 64 64 100.0


line stmt bran cond sub pod time code
1             # -*- coding: utf-8 -*-
2             # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
3 12     12   117 use warnings;
  12     1   36  
  12         473  
  1         11  
  1         6  
  1         62  
4 12     12   73 use rlib '../../../../..';
  12     1   34  
  12         79  
  1         12  
  1         3  
  1         9  
5 12     12   4842 use strict;
  12     1   33  
  12         310  
  1         724  
  1         4  
  1         48  
6 12     12   65 use vars qw(@ISA @SUBCMD_VARS);
  12     1   30  
  12         707  
  1         10  
  1         5  
  1         98  
7              
8             package Devel::Trepan::CmdProcessor::Command::Info::Variables;
9              
10 12     12   83 use Devel::Trepan::CmdProcessor::Command;
  12     1   41  
  12         1660  
  1         12  
  1         4  
  1         210  
11 12     12   88 use Devel::Trepan::CmdProcessor::Command::Subcmd::Core;
  12     1   44  
  12         294  
  1         9  
  1         3  
  1         33  
12 12     12   6156 use Devel::Trepan::CmdProcessor::Command::Subcmd::SubsubMgr;
  12     1   54  
  12         433  
  1         6  
  1         3  
  1         22  
13 12     12   92 use vars qw(@ISA @SUBCMD_VARS);
  12     1   37  
  12         3174  
  1         7  
  1         3  
  1         251  
14             our $MIN_ABBREV = length('va');
15             =pod
16              
17             =head2 Synopsis:
18              
19             =cut
20             our $HELP = <<'HELP';
21             =pod
22              
23             B<info variables> [B<lexicals>|B<my>|B<our> ...]
24              
25             Information on I<our>, I<my>, or I<lexical> variables.
26             =cut
27             HELP
28             our $SHORT_HELP = "List 'our' or 'my' variables.";
29              
30             @ISA = qw(Devel::Trepan::CmdProcessor::Command::SubsubcmdMgr);
31              
32             unless (caller) {
33             # Demo it.
34             # FIXME: DRY with other subcommand manager demo code.
35             require Devel::Trepan::CmdProcessor;
36             my $proc = Devel::Trepan::CmdProcessor->new;
37             my $parent = Devel::Trepan::CmdProcessor::Command::Info->new($proc, 'info');
38             my $cmd = __PACKAGE__->new($parent, 'variables');
39             print $cmd->{help}, "\n";
40             print "min args: ", $cmd->MIN_ARGS, "\n";
41             for my $arg ('le', 'my', 'foo') {
42             my @aref = $cmd->complete_token_with_next($arg);
43             printf "%s\n", @aref ? $aref[0]->[0]: 'undef';
44             }
45              
46             print join(' ', @{$cmd->{prefix}}), "\n";
47             print '-' x 30, "\n";
48             $cmd->run($cmd->{prefix});
49             }
50              
51             1;