lib/Devel/Trepan/CmdProcessor/Command/Undisplay.pm

filter: Statementstmt 74.5% 76 / 102 Branchbran 20.0% 4 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.3% 21 / 23 Podpod 0.0% 0 / 2 totaltotal 68.7% 101 / 147 CC 16 SCAR 24.8
CC
16
Cov
66%
run
24.7
run
24.7
run
24.7
CRAP 12.0
« blib/lib/Devel/Trepan/CmdProcessor/Command/Load_Subcmd/Module.pm ↑ Summary blib/lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Return.pm »
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
3 12 ▶use warnings; no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use rlib '../../../..';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Devel::Trepan::CmdProcessor::Command::Undisplay;
7 12 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 12 ▶use if !@ISA, Devel::Trepan::CmdProcessor::Command ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶unless (@ISA) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ISA) 0 1 1
12 0 ▶ eval <<'EOE';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶use strict; use vars qw(@ISA); @ISA = @CMD_ISA;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
22 12 ▶use vars @CMD_VARS; # Value inherited from parent
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 our $NAME = set_name();
25 =pod
26  
27 =head2 Synopsis:
28  
29 =cut
30 1 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 0 ▶sub run($$) {
Subroutine run: not called CC=6 SCAR=32.1
Subroutine run: not called CC=6 SCAR=32.1
Pod undocumented
Pod undocumented
47 0 my ($self, $args) = @_;
48 0 my $proc = $self->{proc};
49 0 my @args = @$args;
50  
51 0 ▶ if (scalar @args == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @args == 1) 0 0 0
if (scalar @args == 1) 11 0 11
52 0 ▶ if ($proc->confirm('Delete all displays?', 0)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($proc->confirm("Delete all displays?", 0)) 0 0 0
if ($proc->confirm("Delete all displays?", 0)) 0 11 11
53 0 $proc->{displays}->reset;
54 0 return;
55 }
56 }
57 0 shift @args;
58 0 for my $num_str (@args) {
59 0 my $opts = {msg_on_error => sprintf('%s must be a display number', $num_str)};
60 0 my $i = $proc->get_an_int($num_str);
61 0 ▶ if ($i) {
Branch: 2 branches
BranchTrueFalseTotal
if ($i) 0 0 0
if ($i) 0 0 0
62 0 ▶ unless($proc->{displays}->delete($i)) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($proc->{"displays"}->delete($i)) 0 0 0
unless ($proc->{"displays"}->delete($i)) 0 0 0
63 0 $proc->errmsg("No display number $i");
64 0 return;
65 }
66 }
67 }
68 }
69  
70 1 ▶unless (caller) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
71 0 require Devel::Trepan::CmdProcessor::Mock;
72 0 my $proc = Devel::Trepan::CmdProcessor::Mock::setup();
73 # my $cmd = __PACKAGE__->new($proc);
74 # $cmd->run([$NAME]);
75 }
76  
77 1 1;
« blib/lib/Devel/Trepan/CmdProcessor/Command/Load_Subcmd/Module.pm ↑ Summary blib/lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Return.pm »