File Coverage

lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Max_Subcmd/String.pm
Criterion Covered Total %
statement 26 33 78.7
branch n/a
condition n/a
subroutine 9 10 90.0
pod n/a
total 35 43 81.4


line stmt bran cond sub pod time code
1             # -*- coding: utf-8 -*-
2             # Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org>
3 12     12   84 use warnings; no warnings 'redefine'; no warnings 'once';
  12     12   39  
  12     12   519  
  12         81  
  12         28  
  12         382  
  12         76  
  12         30  
  12         625  
4              
5             package Devel::Trepan::CmdProcessor::Command::Set::Max::String;
6              
7             BEGIN {
8 12     12   85 my @OLD_INC = @INC;
9 12     12   69 use rlib '../../../../../..';
  12         33  
  12         74  
10 12     12   5444 use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
  12         32  
  12         340  
11 12         314 @INC = @OLD_INC
12             };
13              
14 12     12   69 use strict;
  12         31  
  12         315  
15 12     12   65 use vars qw(@ISA @SUBCMD_VARS);
  12         32  
  12         743  
16             @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd);
17             # Values inherited from parent
18              
19 12     12   86 use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS;
  12         36  
  12         2770  
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 0     0     my ($self, $args) = @_;
50 0           my @args = @$args;
51 0           shift @args; shift @args; shift @args;
  0            
  0            
52 0           my $num_str = join(' ', @args);
53 0           $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;