File Coverage

lib/Devel/Trepan/CmdProcessor/Command/TBreak.pm
Criterion Covered Total %
statement 63 67 94.0
branch n/a
condition n/a
subroutine 21 23 91.3
pod 0 2 0.0
total 84 92 91.3


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   97 use warnings; no warnings 'redefine';
  12     12   29  
  12     1   367  
  12     1   61  
  12         27  
  12         370  
  1         7  
  1         3  
  1         37  
  1         6  
  1         3  
  1         30  
4              
5 12     12   71 use rlib '../../../..';
  12     1   26  
  12         70  
  1         4  
  1         2  
  1         3  
6              
7             package Devel::Trepan::CmdProcessor::Command::TBreak;
8              
9 12     12   4621 use if !@ISA, Devel::Trepan::CmdProcessor::Command ;
  12     1   27  
  12         68  
  1         356  
  1         3  
  1         4  
10              
11             unless (@ISA) {
12 12     12   71 eval <<'EOE';
  12     12   25  
  12     12   710  
  12     12   73  
  12     12   28  
  12         532  
  12         71  
  12         26  
  12         561  
  12         80  
  12         28  
  12         497  
  12         78  
  12         56  
  12         530  
13             use constant CATEGORY => 'breakpoints';
14             use constant SHORT_HELP => 'Set a one-time breakpoint';
15             use constant MIN_ARGS => 0; # Need at least this many
16             use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited.
17             use constant NEED_STACK => 1;
18             EOE
19             }
20              
21 12     12   1800 use strict;
  12     1   28  
  12         355  
  1         45  
  1         2  
  1         32  
22 12     12   76 use vars qw(@ISA); @ISA = @CMD_ISA;
  12     1   23  
  12         639  
  1         6  
  1         2  
  1         48  
23 12     12   69 use vars @CMD_VARS; # Value inherited from parent
  12     1   23  
  12         1591  
  1         7  
  1         2  
  1         109  
24              
25             our $NAME = set_name();
26             =pod
27              
28             =head2 Synopsis:
29              
30             =cut
31             our $HELP = <<'HELP';
32             =pod
33              
34             B<tbreak> [I<location>]
35              
36             Set a one-time breakpoint. The breakpoint is removed after it is hit.
37             If no location is given use the current stopping point.
38              
39             =head2 Examples:
40              
41             tbreak
42             tbreak 10 # set breakpoint on line 10
43              
44             When a breakpoint is hit the event icon is C<x1>.
45              
46             =head2 See also:
47              
48             L<C<break>|Devel::Trepan::CmdProcessor::Break> and
49             C<help breakpoints>.
50              
51             =cut
52             HELP
53              
54             # This method runs the command
55             sub run($$) {
56 0     0 0   my ($self, $args) = @_;
  0     0 0    
57 12     12   87 no warnings 'once';
  12     1   25  
  12         1146  
  1         7  
  1         2  
  1         92  
58 0           $self->{dbgr}->set_tbreak($DB::filename, $args->[1]);
  0            
59             }
60              
61             unless (caller) {
62             # require_relative '../mock'
63             # dbgr, cmd = MockDebugger::setup
64             # p cmd.run([cmd.name])
65             }
66              
67             1;