blib/lib/Devel/ebug/Backend/Plugin/ActionPoints.pm

filter: Statementstmt 55.9% 47 / 84 Branchbran 35.7% 5 / 14 Conditioncond 14.2% 2 / 14 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 70.5% 12 / 17 Podpod 0.0% 0 / 10 totaltotal 44.5% 66 / 148 CC 14 SCAR 16.9
CC
14
Cov
48%
break_points_with_condition
13.8
all_break_points_with_condition
13.8
break_on_load
6.0
CRAP 5.4
« blib/lib/Devel/ebug/Backend/Plugin/Filenames.pm ↑ Summary lib/Devel/ebug.pm »
1 package Devel::ebug::Backend::Plugin::ActionPoints;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 our $VERSION = '0.69'; # VERSION
8  
9 6 ▶sub register_commands {
Subroutine register_commands: called CC=1 SCAR=0.0
Pod undocumented
10 return (
11 6 break_point => { sub => \&break_point, record => 1 },
12 break_points => { sub => \&break_points },
13 break_points_with_condition => { sub => \&break_points_with_condition },
14 all_break_points_with_condition => { sub => \&all_break_points_with_condition },
15 break_point_delete => { sub => \&break_point_delete, record => 1 },
16 break_point_subroutine => { sub => \&break_point_subroutine, record => 1 },
17 watch_point => { sub => \&watch_point, record => 1 },
18 break_on_load => { sub => \&break_on_load },
19 );
20 }
21 10 ▶sub break_point {
Subroutine break_point: called CC=2 SCAR=7.1
Pod undocumented
22 10 my($req, $context) = @_;
23 10 my $line = set_break_point($req->{filename}, $req->{line}, $req->{condition});
24 10 ▶ return $line ? { line => $line } : {};
Branch: 1 branch
BranchTrueFalseTotal
$line ? : 10 0 10
25 }
26  
27 2 ▶sub break_points {
Subroutine break_points: called CC=2 SCAR=7.0
Pod undocumented
28 2 my($req, $context) = @_;
29 6 ▶ use vars qw(@dbline %dbline);
Subroutine BEGIN: called CC=1 SCAR=0.0
30 2 ▶ my $filename = $req->{filename} || $context->{filename};
Condition33%1/3
$req->{'filename'} || $context->{'filename'}
l!l&&r!l&&!r
020
MC/DC0%0/2
$req->{'filename'} || $context->{'filename'}
$req->{'filename'} $context->{'filename'}
Truth table33%1/3
A || B
A= $req->{'filename'}B= $context->{'filename'}
ABresult
1X1
011
000
31 2 *DB::dbline = $main::{ '_<' . $filename };
32 my $break_points = [
33 1 sort { $a <=> $b }
34 2 grep { $DB::dbline{$_} }
35 keys %DB::dbline
36 ];
37 2 return { break_points => $break_points };
38 }
39  
40 0 ▶sub break_points_with_condition {
Subroutine break_points_with_condition: not called CC=4 SCAR=26.3
Pod undocumented
41 0 my($req, $context) = @_;
42 6 ▶ use vars qw(@dbline %dbline);
Subroutine BEGIN: called CC=1 SCAR=0.0
43 0 ▶ my $filename = $req->{filename} || $context->{filename};
Condition0%0/3
$req->{'filename'} || $context->{'filename'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$req->{'filename'} || $context->{'filename'}
$req->{'filename'} $context->{'filename'}
Truth table0%0/3
A || B
A= $req->{'filename'}B= $context->{'filename'}
ABresult
1X1
011
000
44 0 *DB::dbline = $main::{ '_<' . $filename };
45 my $break_points = [
46 0 map { my $c = $DB::dbline{$_};
47 0 ▶ { filename => $filename, line => $_,
Branch: 1 branch
BranchTrueFalseTotal
$c && $c != 1 ? : 0 0 0
Condition0%0/3
$c and $c != 1
!ll&&!rl&&r
000
MC/DC0%0/2
$c and $c != 1
$c $c != 1
Truth table0%0/3
A and B
A= $cB= $c != 1
ABresult
0X0
100
111
48 ( $c && $c != 1 ) ? ( condition => $c ) : () } }
49 0 sort { $a <=> $b }
50 0 grep { $DB::dbline{$_} }
51 keys %DB::dbline
52 ];
53 0 return { break_points => $break_points };
54 }
55  
56 0 ▶sub all_break_points_with_condition {
Subroutine all_break_points_with_condition: not called CC=4 SCAR=26.3
Pod undocumented
57 0 my($req, $context) = @_;
58 6 ▶ use vars qw(@dbline %dbline);
Subroutine BEGIN: called CC=1 SCAR=0.0
59 0 my $files = Devel::ebug::Backend::Plugin::Filenames::filenames
60 ( $req, $context ); # breaks encapsulation
61 0 my @break_points;
62 0 foreach my $file ( sort @{$files->{filenames}} ) {
63 0 *DB::dbline = $main::{ '_<' . $file };
64 push @break_points,
65 0 map { my $c = $DB::dbline{$_};
66 0 ▶ { filename => $file, line => $_,
Branch: 1 branch
BranchTrueFalseTotal
$c && $c != 1 ? : 0 0 0
Condition0%0/3
$c and $c != 1
!ll&&!rl&&r
000
MC/DC0%0/2
$c and $c != 1
$c $c != 1
Truth table0%0/3
A and B
A= $cB= $c != 1
ABresult
0X0
100
111
67 ( $c && $c != 1 ) ? ( condition => $c ) : () } }
68 0 sort { $a <=> $b }
69 0 grep { $DB::dbline{$_} }
70 keys %DB::dbline;
71 }
72 0 return { break_points => \@break_points };
73 }
74  
75 0 ▶sub break_point_delete {
Subroutine break_point_delete: not called CC=1 SCAR=1.7
Pod undocumented
76 0 my($req, $context) = @_;
77 6 ▶ use vars qw(@dbline %dbline);
Subroutine BEGIN: called CC=1 SCAR=0.0
78 0 *DB::dbline = $main::{ '_<' . $req->{filename} };
79 0 $DB::dbline{$req->{line}} = 0;
80 0 return {};
81 }
82  
83 1 ▶sub break_point_subroutine {
Subroutine break_point_subroutine: called CC=2 SCAR=7.0
Pod undocumented
84 1 my($req, $context) = @_;
85 1 my($filename, $start, $end) = $DB::sub{$req->{subroutine}} =~ m/^(.+):(\d+)-(\d+)$/;
86 1 my $line = set_break_point($filename, $start, $req->{condition});
87 1 ▶ return $line ? { line => $line } : {};
Branch: 1 branch
BranchTrueFalseTotal
$line ? : 1 0 1
88 }
89  
90 0 ▶sub watch_point {
Subroutine watch_point: not called CC=1 SCAR=6.9
Pod undocumented
91 0 my($req, $context) = @_;
92 0 my $watch_point = $req->{watch_point};
93 0 push @{$context->{watch_points}}, $watch_point;
94 0 return {};
95 }
96  
97  
98 # set a break point
99 11 ▶sub set_break_point {
Subroutine set_break_point: called CC=4 SCAR=14.0
Pod undocumented
100 11 my($filename, $line, $condition) = @_;
101 11 ▶ $condition ||= 1;
Condition50%1/2
$condition ||= 1
l!l
011
MC/DC0%0/1
$condition ||= 1
$condition
Truth table50%1/2
A
A= $condition
Aresult
11
00
102 11 *DB::dbline = $main::{ '_<' . $filename };
103  
104 # move forward until a line we can actually break on
105 11 while (1) {
106 115 ▶ return 0 if not defined $DB::dbline[$line]; # end of code
Branch: 1 branch
BranchTrueFalseTotal
unless defined $DB::dbline[$line] 0 115 115
107 115 ▶ last unless $DB::dbline[$line] == 0; # not breakable
Branch: 1 branch
BranchTrueFalseTotal
unless $DB::dbline[$line] == 0 11 104 115
108 104 $line++;
109 }
110 11 $DB::dbline{$line} = $condition;
111 11 return $line;
112 }
113  
114 #set a break point on file loading
115 0 ▶sub break_on_load{
Subroutine break_on_load: not called CC=2 SCAR=17.9
Pod undocumented
116 0 my($req, $context) = @_;
117 0 my $filename = $req->{filename};
118  
119 0 $DB::break_on_load{$filename} = 1;
120  
121 0 ▶ if (!File::Spec->file_name_is_absolute( $filename )){
Branch: 1 branch
BranchTrueFalseTotal
unless ("File::Spec"->file_name_is_absolute($filename)) 0 0 0
122 #add the absolute path
123 0 $filename = File::Spec->rel2abs( $filename);
124 0 $DB::break_on_load{$filename} = 1;
125 }
126  
127 0 return {};
128 }
129  
130  
131 6 1;
132  
133 __END__
« blib/lib/Devel/ebug/Backend/Plugin/Filenames.pm ↑ Summary lib/Devel/ebug.pm »