blib/lib/Devel/LineTrace.pm

filter: Statementstmt 36.3% 16 / 44 Branchbran 7.1% 1 / 14 Conditioncond 20.0% 1 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 29.7% 22 / 74 CC 10 SCAR 33.9
CC
10
Cov
29%
BEGIN
52.5
DB
6.0
DB
6.0
CRAP 29.8
↑ Summary
1 package Devel::LineTrace;
2 1 $Devel::LineTrace::VERSION = '0.1.12';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 require 5.006;
7  
8 package DB;
9 1 $DB::VERSION = '0.1.12';
10 1 my (%files);
11  
12 sub BEGIN
13 1 ▶{
Subroutine BEGIN: called CC=8 SCAR=39.6
14 1 ▶ my $filename = $ENV{'PERL5DB_LT'} || "perl-line-traces.txt";
Condition50%1/2
$ENV{'PERL5DB_LT'} || 'perl-line-traces.txt'
l!l
01
MC/DC0%0/1
$ENV{'PERL5DB_LT'} || 'perl-line-traces.txt'
$ENV{'PERL5DB_LT'}
Truth table50%1/2
A
A= $ENV{'PERL5DB_LT'}
Aresult
11
00
15 1 ▶ open my $in_fh, "<", $filename
Branch: 1 branch
BranchTrueFalseTotal
open my $in_fh, "<", $filename or return 0 1 1
16 or return;
17 0 my $line;
18 0 $line = <$in_fh>;
19 MAIN:
20 0 ▶ while ($line)
Branch: 1 branch
BranchTrueFalseTotal
if ($line) 0 0 0
21 {
22 0 chomp $line;
23 0 ▶ if ( ( $line =~ /^\s+/ ) || ( $line =~ /^#/ ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\s+/ or $line =~ /^#/) 0 0 0
Condition0%0/3
$line =~ /^\s+/ or $line =~ /^#/
l!l&&r!l&&!r
000
MC/DC0%0/2
$line =~ /^\s+/ or $line =~ /^#/
$line =~ /^\s+/ $line =~ /^#/
Truth table0%0/3
A or B
A= $line =~ /^\s+/B= $line =~ /^#/
ABresult
1X1
011
000
24 {
25 0 $line = <$in_fh>;
26 0 next MAIN;
27 }
28 0 $line =~ /^(.+):(\d+)$/;
29 0 my $filename = $1;
30 0 my $line_num = $2;
31 0 my $callback = "";
32 CALLBACK:
33 0 ▶ while ( $line = <$in_fh> )
Branch: 1 branch
BranchTrueFalseTotal
if (defined($line = readline $in_fh)) 0 0 0
34 {
35  
36 0 ▶ if ( $line =~ /^\s/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\s/) { } 0 0 0
37 {
38 0 $callback .= $line;
39 }
40 else
41 {
42 0 last CALLBACK;
43 }
44 }
45 0 $files{$filename}{$line_num} = $callback;
46 }
47 0 close($in_fh);
48  
49 0 return;
50 }
51  
52 1 ▶use vars qw(@saved $package $filename $line $usercontext);
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 sub DB
55 0 ▶{
Subroutine DB: not called CC=2 SCAR=17.9
Pod undocumented
56 0 ▶ local @saved = ( $@, $!, $^E, $,, $/, $\, $^W );
Subroutine DB: not called CC=2 SCAR=17.9
Pod undocumented
57 0 local ( $package, $filename, $line ) = caller;
58 0 local $usercontext = '($@, $!, $^E, $,, $/, $\, $^W) = @saved;'
59 . "package $package;"; # this won't let them modify, alas
60 0 ▶ if ( exists( $files{$filename}{$line} ) )
Branch: 2 branches
BranchTrueFalseTotal
if (exists $files{$DB::filename}{$DB::line}) 0 0 0
if (exists $files{$DB::filename}{$DB::line}) 0 0 0
61 {
62 0 eval $usercontext . " " . $files{$filename}{$line};
63 }
64 }
65  
66 1 1;
67  
68 __END__
↑ Summary