blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/Lines.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 61 CC 1 SCAR 6.9
CC
1
Cov
0%
run
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2015 Rocky Bernstein <rocky@cpan.org>
3 use warnings; no warnings 'redefine'; no warnings 'once';
4 use rlib '../../../../../..';
5  
6 package Devel::Trepan::CmdProcessor::Command::Set::Max::Lines;
7 use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
8  
9 use strict;
10 use vars qw(@ISA @SUBCMD_VARS);
11 @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd);
12 # Values inherited from parent
13  
14 use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS;
15  
16 =pod
17  
18 =head2 Synopsis:
19  
20 =cut
21  
22  
23 our $HELP = <<"HELP";
24 =pod
25  
26 B<set max lines> I<count>
27  
28 Set maximum number of lines of trailing context around the source line.
29  
30 =head2 See also:
31  
32 L<C<show max lines>|Devel::Trepan::CmdProcessor::Show::Max::Lines>
33  
34 =cut
35 HELP
36  
37 our $IN_LIST = 1;
38 our $MIN_ABBREV = length('lin');
39 our $SHORT_HELP = 'Set maximum trailing context lines';
40  
41 sub run($$)
42 {
43 my ($self, $args) = @_;
44 my @args = @$args;
45 shift @args; shift @args; shift @args;
46 my $num_str = join(' ', @args);
47 $self->run_set_int($num_str,
48 "The '$self->{cmd_str}' command requires a line count",
49 1, undef);
50 }
51  
52 unless (caller) {
53 # Demo it.
54 require Devel::Trepan::CmdProcessor;
55 my $cmdproc = Devel::Trepan::CmdProcessor->new();
56 my $subcmd = Devel::Trepan::CmdProcessor::Command::Set->new($cmdproc, 'set');
57 my $parent_cmd = Devel::Trepan::CmdProcessor::Command::Set::Max->new($subcmd, 'lines');
58 my $cmd = __PACKAGE__->new($parent_cmd, 'lines');
59 # Add common routine
60 foreach my $field (qw(min_abbrev name)) {
61 printf "Field %s is: %s\n", $field, $cmd->{$field};
62 }
63 my @args = qw(set max lines 10);
64 $cmd->run(\@args);
65 }
66  
67 1;