File Coverage

lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/Lines.pm
Criterion Covered Total %
statement 24 31 77.4
branch n/a
condition n/a
subroutine 8 9 88.8
pod n/a
total 32 40 80.0


line stmt bran cond sub pod time code
1             # -*- coding: utf-8 -*-
2             # Copyright (C) 2015 Rocky Bernstein <rocky@cpan.org>
3 12     12   81 use warnings; no warnings 'redefine'; no warnings 'once';
  12     12   36  
  12     12   516  
  12         73  
  12         39  
  12         441  
  12         84  
  12         34  
  12         351  
4 12     12   87 use rlib '../../../../../..';
  12         39  
  12         86  
5              
6             package Devel::Trepan::CmdProcessor::Command::Set::Max::Lines;
7 12     12   5124 use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
  12         33  
  12         265  
8              
9 12     12   61 use strict;
  12         35  
  12         279  
10 12     12   60 use vars qw(@ISA @SUBCMD_VARS);
  12         30  
  12         822  
11             @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd);
12             # Values inherited from parent
13              
14 12     12   91 use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS;
  12         35  
  12         4079  
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 0     0     my ($self, $args) = @_;
44 0           my @args = @$args;
45 0           shift @args; shift @args; shift @args;
  0            
  0            
46 0           my $num_str = join(' ', @args);
47 0           $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;