« blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/String.pm
↑ Summary
blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Substitute.pm »
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | # Copyright (C) 2011-2012, 2014-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::Width; | ||
| 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 width> I<count> | ||
| 27 | |||
| 28 | Set number of characters the debugger thinks are in a line. | ||
| 29 | |||
| 30 | =head2 See also: | ||
| 31 | |||
| 32 | L<C<show max width>|Devel::Trepan::CmdProcessor::Show::Max::Width> | ||
| 33 | |||
| 34 | =cut | ||
| 35 | HELP | ||
| 36 | |||
| 37 | our $IN_LIST = 1; | ||
| 38 | our $MIN_ABBREV = length('wid'); | ||
| 39 | our $SHORT_HELP = 'Set maximum width of a line'; | ||
| 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 width", | ||
| 49 | 10, undef); | ||
| 50 | } | ||
| 51 | |||
| 52 | unless (caller) { | ||
| 53 | # Demo it. | ||
| 54 | # require_relative '../../../mock' | ||
| 55 | # name = File.basename(__FILE__, '.rb') | ||
| 56 | |||
| 57 | # dbgr, set_cmd = MockDebugger::setup('set') | ||
| 58 | # max_cmd = Trepan::SubSubcommand::SetMax.new(dbgr.core.processor, | ||
| 59 | # set_cmd) | ||
| 60 | # cmd_ary = Trepan::SubSubcommand::SetMaxWidth::PREFIX | ||
| 61 | # cmd_name = cmd_ary.join(' ') | ||
| 62 | # subcmd = Trepan::SubSubcommand::SetMaxWidth.new(set_cmd.proc, | ||
| 63 | # max_cmd, | ||
| 64 | # cmd_name) | ||
| 65 | # prefix_run = cmd_ary[1..-1] | ||
| 66 | # subcmd.run(prefix_run) | ||
| 67 | # subcmd.run(prefix_run + %w(0)) | ||
| 68 | # subcmd.run(prefix_run + %w(20)) | ||
| 69 | # name = File.basename(__FILE__, '.rb') | ||
| 70 | # subcmd.summary_help(name) | ||
| 71 | # puts | ||
| 72 | # puts '-' * 20 | ||
| 73 | # puts subcmd.save_command | ||
| 74 | } | ||
| 75 | |||
| 76 | 1; |