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

filter: Statementstmt 79.8% 79 / 99 Branchbran 20.0% 4 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 22 / 24 Podpod 0.0% 0 / 2 totaltotal 72.4% 105 / 145 CC 16 SCAR 23.8
CC
16
Cov
70%
run
22.8
run
22.8
run
22.8
CRAP 10.8
« blib/lib/Devel/Trepan/Condition.pm ↑ Summary lib/Devel/Trepan/Interface.pm »
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-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::Delete;
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
Subroutine BEGIN: called CC=1 SCAR=0.0
13 use constant ALIASES => qw(d);
14 use constant CATEGORY => 'breakpoints';
15 use constant SHORT_HELP => 'Delete some breakpoints';
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 use constant NEED_STACK => 0;
19 EOE
20 }
21  
22 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
23 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
24  
25 1 our $NAME = set_name();
26 =pod
27  
28 =head2 Synopsis:
29  
30 =cut
31 1 our $HELP = <<'HELP';
32 =pod
33  
34 B<delete> [I<bp-number> [I<bp-number>...]]
35  
36 Delete some breakpoints.
37  
38 Arguments are breakpoint numbers with spaces in between. To delete
39 all breakpoints, give no arguments.
40  
41 See also the C<clear> command which clears breakpoints by line number
42 and C<info break> to get a list of breakpoint numbers.
43  
44 =head2 Examples:
45  
46 delete 1 # delete breakpoint number 1
47  
48 =head2 See also:
49  
50 L<C<break>|Devel::Trepan::CmdProcessor::Command::Break>,
51 L<C<enable>|Devel::Trepan::CmdProcessor::Command::Enable>, and
52 L<C<disable>|Devel::Trepan::CmdProcessor::Command::Disable>.
53  
54 =cut
55 HELP
56  
57 # This method runs the command
58 0 ▶sub run($$) {
Subroutine run: not called CC=6 SCAR=31.2
Subroutine run: not called CC=6 SCAR=31.2
Pod undocumented
Pod undocumented
59 0 my ($self, $args) = @_;
60 0 my $proc = $self->{proc};
61 0 my @args = @$args;
62  
63 0 ▶ if (scalar @args == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @args == 1) 0 0 0
if (scalar @args == 1) 11 0 11
64 0 ▶ if ($proc->confirm('Delete all breakpoints?', 0)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($proc->confirm("Delete all breakpoints?", 0)) 0 0 0
if ($proc->confirm("Delete all breakpoints?", 0)) 0 11 11
65 0 $proc->{brkpts}->reset;
66 0 return;
67 }
68 }
69 0 shift @args;
70 0 for my $num_str (@args) {
71 0 my $bp_num = $proc->get_an_int($num_str);
72 0 ▶ my $success = $proc->{brkpts}->delete($bp_num) if $bp_num;
Branch: 2 branches
BranchTrueFalseTotal
if $bp_num 0 0 0
if $bp_num 0 0 0
73 0 ▶ $proc->msg("Deleted breakpoint $bp_num") if $success;
Branch: 2 branches
BranchTrueFalseTotal
if $success 0 0 0
if $success 0 0 0
74 }
75 }
76  
77 1 ▶unless (caller) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
78 0 require Devel::Trepan::CmdProcessor::Mock;
79 0 my $proc = Devel::Trepan::CmdProcessor::Mock::setup();
80 # my $cmd = __PACKAGE__->new($proc);
81 # $cmd->run([$NAME]);
82 }
83  
84 1 1;
« blib/lib/Devel/Trepan/Condition.pm ↑ Summary lib/Devel/Trepan/Interface.pm »