« blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/Stack.pm
↑ Summary
blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/Width.pm »
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | # Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org> | ||
| 3 | use warnings; no warnings 'redefine'; no warnings 'once'; | ||
| 4 | |||
| 5 | package Devel::Trepan::CmdProcessor::Command::Set::Max::String; | ||
| 6 | |||
| 7 | BEGIN { | ||
| 8 | my @OLD_INC = @INC; | ||
| 9 | use rlib '../../../../../..'; | ||
| 10 | use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd; | ||
| 11 | @INC = @OLD_INC | ||
| 12 | }; | ||
| 13 | |||
| 14 | use strict; | ||
| 15 | use vars qw(@ISA @SUBCMD_VARS); | ||
| 16 | @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd); | ||
| 17 | # Values inherited from parent | ||
| 18 | |||
| 19 | use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS; | ||
| 20 | |||
| 21 | our $IN_LIST = 1; | ||
| 22 | =pod | ||
| 23 | |||
| 24 | =head2 Synopsis: | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | our $HELP = <<'HELP'; | ||
| 29 | =pod | ||
| 30 | |||
| 31 | B<Set max string>] I<count> | ||
| 32 | |||
| 33 | Sometimes the string representation of an object is very long. This | ||
| 34 | setting limits how much of the string representation you want to | ||
| 35 | see. However if the string has an embedded newline then we will assume | ||
| 36 | the output is intended to be formated as is. | ||
| 37 | |||
| 38 | =head2 See also: | ||
| 39 | |||
| 40 | L<C<show max string>|Devel::Trepan::CmdProcessor::Command::Show::Max::String> | ||
| 41 | =cut | ||
| 42 | HELP | ||
| 43 | |||
| 44 | our $MIN_ABBREV = length('str'); | ||
| 45 | our $SHORT_HELP = "Set maximum chars in a string before truncation"; | ||
| 46 | |||
| 47 | sub run($$) | ||
| 48 | { | ||
| 49 | my ($self, $args) = @_; | ||
| 50 | my @args = @$args; | ||
| 51 | shift @args; shift @args; shift @args; | ||
| 52 | my $num_str = join(' ', @args); | ||
| 53 | $self->run_set_int($num_str, | ||
| 54 | "The '$self->{cmd_str}' command requires a line width", | ||
| 55 | 0); | ||
| 56 | } | ||
| 57 | |||
| 58 | unless (caller) { | ||
| 59 | # Demo it. | ||
| 60 | # require_relative '../../../mock' | ||
| 61 | # name = File.basename(__FILE__, '.rb') | ||
| 62 | |||
| 63 | # dbgr, set_cmd = MockDebugger::setup('set') | ||
| 64 | # max_cmd = Trepan::SubSubcommand::SetMax.new(dbgr.core.processor, | ||
| 65 | # set_cmd) | ||
| 66 | # cmd_ary = Trepan::SubSubcommand::SetMaxString::PREFIX | ||
| 67 | # cmd_name = cmd_ary.join(' ') | ||
| 68 | # subcmd = Trepan::SubSubcommand::SetMaxStringa.new(set_cmd.proc, | ||
| 69 | # max_cmd, | ||
| 70 | # cmd_name) | ||
| 71 | # prefix_run = cmd_ary[1..-1] | ||
| 72 | # subcmd.run(prefix_run) | ||
| 73 | # subcmd.run(prefix_run + %w(0)) | ||
| 74 | # subcmd.run(prefix_run + %w(20)) | ||
| 75 | # name = File.basename(__FILE__, '.rb') | ||
| 76 | # subcmd.summary_help(name) | ||
| 77 | # puts | ||
| 78 | # puts '-' * 20 | ||
| 79 | # puts subcmd.save_command | ||
| 80 | } | ||
| 81 | |||
| 82 | 1; |