File Coverage

lib/Devel/ebug/Plugin/ActionPoints.pm
Criterion Covered Total %
statement 47 47 100.0
branch 4 4 100.0
condition n/a
subroutine 11 11 100.0
pod 0 8 0.0
total 62 70 88.5


line stmt bran cond sub pod time code
1             package Devel::ebug::Plugin::ActionPoints;
2              
3 19     19   10255 use strict;
  19         38  
  19         511  
4 19     19   88 use warnings;
  19         27  
  19         480  
5 19     19   82 use base qw(Exporter);
  19         32  
  19         12362  
6             our @EXPORT = qw(break_point break_point_delete break_point_subroutine break_points break_points_with_condition all_break_points_with_condition watch_point break_on_load);
7              
8             our $VERSION = '0.62_01'; # TRIAL VERSION
9             $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
10              
11             # set a break point (by default in the current file)
12             sub break_point {
13 21     21 0 3885 my $self = shift;
14 21         88 my($filename, $line, $condition);
15 21 100       201 if ($_[0] =~ /^\d+$/) {
16 17         129 $filename = $self->filename;
17             } else {
18 4         43 $filename = shift;
19             }
20 21         202 ($line, $condition) = @_;
21 21         247 my $response = $self->talk({
22             command => "break_point",
23             filename => $filename,
24             line => $line,
25             condition => $condition,
26             });
27 21         162 return $response->{line};
28             }
29              
30             # delete a break point (by default in the current file)
31             sub break_point_delete {
32 2     2 0 25 my $self = shift;
33 2         6 my($filename, $line);
34 2         5 my $first = shift;
35 2 100       16 if ($first =~ /^\d+$/) {
36 1         11 $line = $first;
37 1         8 $filename = $self->filename;
38             } else {
39 1         2 $filename = $first;
40 1         2 $line = shift;
41             }
42              
43 2         19 my $response = $self->talk({
44             command => "break_point_delete",
45             filename => $filename,
46             line => $line,
47             });
48             }
49              
50             # set a break point
51             sub break_point_subroutine {
52 7     7 0 11261 my($self, $subroutine) = @_;
53 7         87 my $response = $self->talk({
54             command => "break_point_subroutine",
55             subroutine => $subroutine,
56             });
57 7         81 return $response->{line};
58             }
59              
60             # list break points
61             sub break_points {
62 5     5 0 138 my($self, $filename) = @_;
63 5         77 my $response = $self->talk({
64             command => "break_points",
65             filename => $filename,
66             });
67 5         27 return @{$response->{break_points}};
  5         97  
68             }
69              
70             # list break points with condition
71             sub break_points_with_condition {
72 2     2 0 24 my($self, $filename) = @_;
73 2         19 my $response = $self->talk({
74             command => "break_points_with_condition",
75             filename => $filename,
76             });
77 2         7 return @{$response->{break_points}};
  2         53  
78             }
79              
80             # list break points with condition for the whole program
81             sub all_break_points_with_condition {
82 1     1 0 4 my($self, $filename) = @_;
83 1         7 my $response = $self->talk({
84             command => "all_break_points_with_condition",
85             filename => $filename,
86             });
87 1         5 return @{$response->{break_points}};
  1         27  
88             }
89              
90              
91             # set a watch point
92             sub watch_point {
93 4     4 0 104 my($self, $watch_point) = @_;
94 4         24 my $response = $self->talk({
95             command => "watch_point",
96             watch_point => $watch_point,
97             });
98             }
99              
100              
101             # set a break point on file loading
102             sub break_on_load {
103 2     2 0 95 my $self = shift;
104 2         11 my($filename) = @_;
105              
106 2         25 my $response = $self->talk({
107             command => "break_on_load",
108             filename => $filename,
109             });
110 2         10 return $response->{line};
111             }
112              
113             1;
114              
115             __END__