Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rocky Bernstein
committed
Nov 18, 2015
1 parent
4e73bdb
commit dbb336a
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/Lines.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2015 Rocky Bernstein <rocky@cpan.org> | ||
use warnings; no warnings 'redefine'; no warnings 'once'; | ||
use rlib '../../../../../..'; | ||
|
||
package Devel::Trepan::CmdProcessor::Command::Set::Max::Lines; | ||
use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd; | ||
|
||
use strict; | ||
use vars qw(@ISA @SUBCMD_VARS); | ||
@ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd); | ||
# Values inherited from parent | ||
|
||
use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS; | ||
|
||
=pod | ||
=head2 Synopsis: | ||
=cut | ||
|
||
|
||
our $HELP = <<"HELP"; | ||
=pod | ||
B<set max lines> I<count> | ||
Set maximum number of lines of trailing context around the source line. | ||
=head2 See also: | ||
L<C<show max lines>|Devel::Trepan::CmdProcessor::Show::Max::Lines> | ||
=cut | ||
HELP | ||
|
||
our $IN_LIST = 1; | ||
our $MIN_ABBREV = length('lin'); | ||
|
||
sub run($$) | ||
{ | ||
my ($self, $args) = @_; | ||
my @args = @$args; | ||
shift @args; shift @args; shift @args; | ||
my $num_str = join(' ', @args); | ||
$self->run_set_int($num_str, | ||
"The '$self->{cmd_str}' command requires a line count", | ||
1, undef); | ||
} | ||
|
||
unless (caller) { | ||
# Demo it. | ||
require Devel::Trepan::CmdProcessor; | ||
my $cmdproc = Devel::Trepan::CmdProcessor->new(); | ||
my $subcmd = Devel::Trepan::CmdProcessor::Command::Set->new($cmdproc, 'set'); | ||
my $parent_cmd = Devel::Trepan::CmdProcessor::Command::Set::Max->new($subcmd, 'lines'); | ||
my $cmd = __PACKAGE__->new($parent_cmd, 'lines'); | ||
# Add common routine | ||
foreach my $field (qw(min_abbrev name)) { | ||
printf "Field %s is: %s\n", $field, $cmd->{$field}; | ||
} | ||
my @args = qw(set max lines 10); | ||
$cmd->run(\@args); | ||
} | ||
|
||
1; |
56 changes: 56 additions & 0 deletions
56
lib/Devel/Trepan/CmdProcessor/Command/Show_Subcmd/Max_Subcmd/Lines.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2011, 2014-2015 Rocky Bernstein <rocky@cpan.org> | ||
use warnings; no warnings 'redefine'; no warnings 'once'; | ||
use rlib '../../../../../..'; | ||
|
||
package Devel::Trepan::CmdProcessor::Command::Show::Max::Lines; | ||
|
||
use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd; | ||
|
||
use strict; | ||
use vars qw(@ISA @SUBCMD_VARS); | ||
@ISA = qw(Devel::Trepan::CmdProcessor::Command::ShowIntSubsubcmd); | ||
# Values inherited from parent | ||
|
||
use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS; | ||
|
||
our $IN_LIST = 1; | ||
our $MIN_ABBREV = length('lines'); | ||
=pod | ||
=head2 Synopsis: | ||
=cut | ||
|
||
our $HELP = <<"HELP"; | ||
=pod | ||
B<show max lines> | ||
Set maximum number of lines of trailing context around the source line. | ||
=head2 See also: | ||
L<C<set max lines>|Devel::Trepan::CmdProcessor::Set::Max::Lines> | ||
=cut | ||
HELP | ||
|
||
our $SHORT_HELP = 'Show the number of characters the debugger thinks are in a line'; | ||
|
||
unless (caller) { | ||
require Devel::Trepan::CmdProcessor; | ||
my $cmdproc = Devel::Trepan::CmdProcessor->new(); | ||
my $subcmd = Devel::Trepan::CmdProcessor::Command::Show->new($cmdproc, 'set'); | ||
my $parent_cmd = Devel::Trepan::CmdProcessor::Command::Show::Max->new($subcmd, 'lines'); | ||
my $cmd = __PACKAGE__->new($parent_cmd, 'lines'); | ||
# Add common routine | ||
foreach my $field (qw(min_abbrev name)) { | ||
printf "Field %s is: %s\n", $field, $cmd->{$field}; | ||
} | ||
my @args = qw(show max lines); | ||
$cmd->run(\@args); | ||
} | ||
|
||
1; |