File Coverage

lib/Devel/Trepan/CmdProcessor/Command/Undisplay.pm
Criterion Covered Total %
statement 63 93 67.7
branch 0 16 0.0
condition n/a
subroutine 21 23 91.3
pod 0 2 0.0
total 84 134 62.6


line stmt bran cond sub pod time code
1             # -*- coding: utf-8 -*-
2             # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
3 12     12   98 use warnings; no warnings 'redefine';
  12     12   27  
  12     1   372  
  12     1   57  
  12         24  
  12         331  
  1         7  
  1         2  
  1         23  
  1         5  
  1         1  
  1         26  
4 12     12   60 use rlib '../../../..';
  12     1   23  
  12         62  
  1         5  
  1         3  
  1         4  
5              
6             package Devel::Trepan::CmdProcessor::Command::Undisplay;
7 12     12   4577 use English qw( -no_match_vars );
  12     1   41  
  12         94  
  1         340  
  1         2  
  1         8  
8              
9 12     12   4534 use if !@ISA, Devel::Trepan::CmdProcessor::Command ;
  12     1   28  
  12         67  
  1         286  
  1         3  
  1         5  
10              
11             unless (@ISA) {
12 12     12   77 eval <<'EOE';
  12     12   21  
  12     12   858  
  12     12   67  
  12     12   29  
  12         694  
  12         103  
  12         29  
  12         591  
  12         72  
  12         33  
  12         589  
  12         73  
  12         27  
  12         446  
13             use constant CATEGORY => 'data';
14             use constant NEED_STACK => 0;;
15             use constant SHORT_HELP => 'Cancel some expressions to be displayed when program stops';
16             use constant MIN_ARGS => 0; # Need at least this many
17             use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited.
18             EOE
19             }
20              
21 12     12   1731 use strict; use vars qw(@ISA); @ISA = @CMD_ISA;
  12     12   29  
  12     1   331  
  12     1   62  
  12         23  
  12         839  
  1         59  
  1         2  
  1         34  
  1         6  
  1         2  
  1         50  
22 12     12   81 use vars @CMD_VARS; # Value inherited from parent
  12     1   25  
  12         4044  
  1         6  
  1         2  
  1         292  
23              
24             our $NAME = set_name();
25             =pod
26              
27             =head2 Synopsis:
28              
29             =cut
30             our $HELP = <<'HELP';
31             =pod
32              
33             B<undisplay> [I<display-number> ...]
34              
35             Cancel some expressions to be displayed when program stops. Arguments
36             are the code numbers of the expressions to stop displaying. No
37             argument means cancel all automatic-display expressions.
38              
39             =head2 See also:
40              
41             L<C<info display>|Devel::Trepan::CmdProcessor::Command::Info::Display>
42             =cut
43             HELP
44              
45             # This method runs the command
46             sub run($$) {
47 0     0 0   my ($self, $args) = @_;
  0     0 0    
48 0           my $proc = $self->{proc};
  0            
49 0           my @args = @$args;
  0            
50              
51 0 0         if (scalar @args == 1) {
  0 0          
52 0 0         if ($proc->confirm('Delete all displays?', 0)) {
  0 0          
53 0           $proc->{displays}->reset;
  0            
54 0           return;
  0            
55             }
56             }
57 0           shift @args;
  0            
58 0           for my $num_str (@args) {
  0            
59 0           my $opts = {msg_on_error => sprintf('%s must be a display number', $num_str)};
  0            
60 0           my $i = $proc->get_an_int($num_str);
  0            
61 0 0         if ($i) {
  0 0          
62 0 0         unless($proc->{displays}->delete($i)) {
  0 0          
63 0           $proc->errmsg("No display number $i");
  0            
64 0           return;
  0            
65             }
66             }
67             }
68             }
69              
70             unless (caller) {
71             require Devel::Trepan::CmdProcessor::Mock;
72             my $proc = Devel::Trepan::CmdProcessor::Mock::setup();
73             # my $cmd = __PACKAGE__->new($proc);
74             # $cmd->run([$NAME]);
75             }
76              
77             1;