util/ppixref

filter: Statementstmt 54.1% 105 / 194 Branchbran 43.4% 33 / 76 Conditioncond 36.1% 13 / 36 MC/DCmcdc 11.1% 2 / 18 Subroutinesub 56.2% 18 / 32 Podpod n/a totaltotal 48.0% 171 / 356 CC 25 SCAR 16.0
CC
25
Cov
49%
__ANON__
13.7
emit
9.2
__ANON__
6.0
CRAP 5.0
« blib/lib/PPI/Xref.pm ↑ Summary
1 #!/usr/bin/env perl
2  
3 1 ▶use PPI::Xref;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use File::Basename qw[basename];
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 my $ME = basename($0);
10  
11 1 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 Getopt::Long::Configure(qw[no_auto_abbrev]);
13  
14 1 ▶use PPI::Xref::Help;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶sub short_help {
Subroutine short_help: not called CC=1 SCAR=6.9
17 0 PPI::Xref::Help::short_help($ME, *DATA);
18 }
19  
20 0 ▶sub long_help {
Subroutine long_help: not called CC=1 SCAR=6.9
21 0 PPI::Xref::Help::long_help($ME, *DATA);
22 }
23  
24 0 ▶sub man_help {
Subroutine man_help: not called CC=1 SCAR=6.9
25 0 PPI::Xref::Help::man_help($ME, *DATA);
26 }
27  
28 1 my %OptDefault = (
29 separator => "\t",
30 recurse => 1,
31 report_title => 1,
32 missing_modules => 1,
33 parse_errors => 1,
34 auto_semicolon => 1,
35 );
36  
37 1 my %Opt = %OptDefault;
38  
39 short_help()
40 unless GetOptions('files' => \$Opt{files},
41 'subs' => \$Opt{subs},
42 'packages' => \$Opt{packages},
43 'modules' => \$Opt{modules},
44 'missing_modules!' => \$Opt{missing_modules},
45 'parse_errors!' => \$Opt{parse_errors},
46 'total_lines' => \$Opt{total_lines},
47 'files_lines' => \$Opt{files_lines},
48 'subs_files' => \$Opt{subs_files},
49 'packages_files' => \$Opt{packages_files},
50 'incs_files' => \$Opt{incs_files},
51 'incs_chains' => \$Opt{incs_chains},
52 'incs_chains_reverse' => \$Opt{incs_chains_reverse},
53 'files_counts' => \$Opt{files_counts},
54 'modules_counts' => \$Opt{modules_counts},
55 'incs_deps' => \$Opt{incs_deps},
56 'parse' => \$Opt{parse},
57 'report_all' => \$Opt{report_all},
58 'report_prefix=s' => \$Opt{report_prefix},
59 'report_title!' => \$Opt{report_title},
60 'INC=s' => \$Opt{INC},
61 'cache_directory=s' => \$Opt{cache_directory},
62 'code=s' => \$Opt{code},
63 'auto_semicolon!' => \$Opt{auto_semicolon},
64 'files_from_file=s' => \$Opt{files_from_file},
65 'files_from_cache' => \$Opt{files_from_cache},
66 'files_from_system' => \$Opt{files_from_system},
67 'cache_read_only' => \$Opt{cache_read_only},
68 'process_verbose' => \$Opt{process_verbose},
69 'recurse_verbose' => \$Opt{recurse_verbose},
70 'cache_verbose' => \$Opt{cache_verbose},
71 'summary' => \$Opt{summary},
72 'separator=s' => \$Opt{separator},
73 'recurse!' => \$Opt{recurse},
74 'column' => \$Opt{column},
75 'finish' => \$Opt{finish},
76 'help' => \$Opt{short_help},
77 'short_help' => \$Opt{short_help},
78 'long_help' => \$Opt{long_help},
79 'man' => \$Opt{man_help},
80 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
unless &GetOptions("files", \$Opt{"files"}, "subs", \$Opt{"subs"}, "packages", \$Opt{"packages"}, "modules", \$Opt{"modules"}, "missing_modules!", \$Opt{"missing_modules"}, "parse_errors!", \$Opt{"parse_errors"}, "total_lines", \$Opt{"total_lines"}, "files_lines", \$Opt{"files_lines"}, "subs_files", \$Opt{"subs_files"}, "packages_files", \$Opt{"packages_files"}, "incs_files", \$Opt{"incs_files"}, "incs_chains", \$Opt{"incs_chains"}, "incs_chains_reverse", \$Opt{"incs_chains_reverse"}, "files_counts", \$Opt{"files_counts"}, "modules_counts", \$Opt{"modules_counts"}, "incs_deps", \$Opt{"incs_deps"}, "parse", \$Opt{"parse"}, "report_all", \$Opt{"report_all"}, "report_prefix=s", \$Opt{"report_prefix"}, "report_title!", \$Opt{"report_title"}, "INC=s", \$Opt{"INC"}, "cache_directory=s", \$Opt{"cache_directory"}, "code=s", \$Opt{"code"}, "auto_semicolon!", \$Opt{"auto_semicolon"}, "files_from_file=s", \$Opt{"files_from_file"}, "files_from_cache", \$Opt{"files_from_cache"}, "files_from_system", \$Opt{"files_from_system"}, "cache_read_only", \$Opt{"cache_read_only"}, "process_verbose", \$Opt{"process_verbose"}, "recurse_verbose", \$Opt{"recurse_verbose"}, "cache_verbose", \$Opt{"cache_verbose"}, "summary", \$Opt{"summary"}, "separator=s", \$Opt{"separator"}, "recurse!", \$Opt{"recurse"}, "column", \$Opt{"column"}, "finish", \$Opt{"finish"}, "help", \$Opt{"short_help"}, "short_help", \$Opt{"short_help"}, "long_help", \$Opt{"long_help"}, "man", \$Opt{"man_help"}) 0 1 1
81  
82 1 ▶short_help() if $Opt{short_help};
Branch: 1 branch
BranchTrueFalseTotal
if $Opt{"short_help"} 0 1 1
83 1 ▶long_help() if $Opt{long_help};
Branch: 1 branch
BranchTrueFalseTotal
if $Opt{"long_help"} 0 1 1
84 1 ▶man_help() if $Opt{man_help};
Branch: 1 branch
BranchTrueFalseTotal
if $Opt{"man_help"} 0 1 1
85  
86 1 my @ACTION = qw[files subs packages modules missing_modules parse_errors
87 subs_files packages_files files_lines total_lines
88 files_counts modules_counts
89 incs_files incs_deps incs_chains incs_chains_reverse];
90
91 1 ▶if ($Opt{report_all}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Opt{"report_all"}) 0 1 1
92 0 @Opt{@ACTION} = (1) x @ACTION;
93 }
94  
95 1 ▶use List::Util qw[any];
Subroutine BEGIN: called CC=1 SCAR=0.0
96 1 ▶short_help() unless (any { $Opt{$_} }
Subroutine __ANON__: called CC=1 SCAR=0.0
97 16 grep { ! $OptDefault{$_} }
98 @ACTION) ||
99 1 ▶ $Opt{parse};
Branch: 1 branch
BranchTrueFalseTotal
unless &any(sub { $Opt{$_}; } , grep({not $OptDefault{$_};} @ACTION)) or $Opt{"parse"} 0 1 1
Condition33%1/3
&any(sub { $Opt{$_}; } , grep({not $OptDefault{$_};} @ACTION)) or $Opt{"parse"}
l!l&&r!l&&!r
100
MC/DC0%0/2
&any(sub { $Opt{$_}; } , grep({not $OptDefault{$_};} @ACTION)) or $Opt{"parse"}
&any(sub { $Opt{$_}; } , grep({not $OptDefault{$_};} @ACTION)) $Opt{"parse"}
Truth table33%1/3
A or B
A= &any(sub { $Opt{$_}; } , grep({not $OptDefault{$_};} @ACTION))B= $Opt{"parse"}
ABresult
1X1
011
000
100  
101 1 ▶$Opt{separator} = "\t" if $Opt{separator} eq '\t'; # Nicer to type in shells.
Branch: 1 branch
BranchTrueFalseTotal
if $Opt{"separator"} eq "\\t" 0 1 1
102  
103 1 ▶if ($Opt{process_verbose} ||
Branch: 1 branch
BranchTrueFalseTotal
if ($Opt{"process_verbose"} or $Opt{"recurse_verbose"} or $Opt{"cache_verbose"} or $Opt{"summary"}) 0 1 1
Condition33%3/9
$Opt{"process_verbose"} or $Opt{"recurse_verbose"} or $Opt{"cache_verbose"} or $Opt{"summary"}
l!l&&r!l&&!r
001
$Opt{"process_verbose"} or $Opt{"recurse_verbose"} or $Opt{"cache_verbose"}
l!l&&r!l&&!r
001
$Opt{"process_verbose"} or $Opt{"recurse_verbose"}
l!l&&r!l&&!r
001
MC/DC0%0/4
$Opt{"process_verbose"} or $Opt{"recurse_verbose"} or $Opt{"cache_verbose"} or $Opt{"summary"}
$Opt{"process_verbose"} $Opt{"recurse_verbose"} $Opt{"cache_verbose"} $Opt{"summary"}
Truth table20%1/5
A or B or C or D
A= $Opt{"process_verbose"}B= $Opt{"recurse_verbose"}C= $Opt{"cache_verbose"}D= $Opt{"summary"}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
104 $Opt{recurse_verbose} ||
105 $Opt{cache_verbose} ||
106 $Opt{summary}) {
107 0 select(STDOUT); $| = 1;
108 }
109  
110 my $xref_opt = {
111 process_verbose => $Opt{process_verbose},
112 recurse_verbose => $Opt{recurse_verbose},
113 cache_verbose => $Opt{cache_verbose},
114 cache_read_only => $Opt{cache_read_only},
115 recurse => $Opt{recurse},
116 1 };
117  
118 1 ▶if (defined $Opt{INC}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{"INC"}) 0 1 1
119 0 $xref_opt->{INC} = [ split(',', $Opt{INC}) ];
120 }
121  
122 1 ▶if (defined $Opt{cache_directory}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{'cache_directory'}) { } 1 0 1
123 1 ▶ unless (-d $Opt{cache_directory} && -r $Opt{cache_directory} && -w $Opt{cache_directory}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $Opt{"cache_directory"} and -r $Opt{"cache_directory"} and -w $Opt{"cache_directory"}) 0 1 1
Condition33%2/6
-d $Opt{"cache_directory"} and -r $Opt{"cache_directory"} and -w $Opt{"cache_directory"}
!ll&&!rl&&r
001
-d $Opt{"cache_directory"} and -r $Opt{"cache_directory"}
!ll&&!rl&&r
001
MC/DC0%0/3
-d $Opt{"cache_directory"} and -r $Opt{"cache_directory"} and -w $Opt{"cache_directory"}
-d $Opt{"cache_directory"} -r $Opt{"cache_directory"} -w $Opt{"cache_directory"}
Truth table25%1/4
A and B and C
A= -d $Opt{"cache_directory"}B= -r $Opt{"cache_directory"}C= -w $Opt{"cache_directory"}
ABCresult
0XX0
10X0
1100
1111
124 0 warn "$ME: Not a read-write directory --cache_directory='$Opt{cache_directory}'\n";
125 }
126 1 $xref_opt->{cache_directory} = $Opt{cache_directory};
127 } else {
128 0 warn "$ME: No --cache_directory specified\n";
129 }
130  
131 1 my $xref = PPI::Xref->new($xref_opt);
132  
133 1 package Times {
134 1 ▶ use Time::HiRes ();
Subroutine BEGIN: called CC=1 SCAR=0.0
135 3 ▶ sub get { bless [ Time::HiRes::time(), times() ] }
Subroutine get: called CC=1 SCAR=0.0
136 0 ▶ sub diff {
Subroutine diff: not called CC=1 SCAR=6.9
137 0 my @d = map { $_[0]->[$_] - $_[1]->[$_] } 0..2;
138 0 return (@d, $d[1] + $d[2]);
139 }
140 }
141  
142 1 my $t0 = Times->get();
143  
144 1 ▶if (defined $Opt{files_from_file}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{"files_from_file"}) 0 1 1
145 0 my $fh;
146 0 ▶ if ($Opt{files_from_file} eq '-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($Opt{'files_from_file'} eq '-') { } 0 0 0
elsif (not open($fh, '<', $Opt{'files_from_file'})) { } 0 0 0
147 0 $fh = *STDIN;
148 } elsif (!open($fh, '<', $Opt{files_from_file})) {
149 0 warn "$ME: Failed to open --files_from_file='$Opt{files_from_file}': $!\n";
150 }
151 1 ▶ use Scalar::Util qw[openhandle];
Subroutine BEGIN: called CC=1 SCAR=0.0
152 0 ▶ if (openhandle($fh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&openhandle($fh)) { } 0 0 0
153 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
154 0 chomp;
155 0 ▶ unless ($xref->process($_)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($xref->process($_)) 0 0 0
156 0 warn "$ME: Failed to process '$_'\n";
157 }
158 }
159 } else {
160 0 help();
161 }
162 }
163  
164 1 my $processed;
165  
166 1 ▶if (defined $Opt{files_from_cache}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{"files_from_cache"}) 0 1 1
167 0 $xref->process_files_from_cache();
168 0 $processed++;
169 }
170 1 ▶if (defined $Opt{files_from_system}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{"files_from_system"}) 0 1 1
171 0 $xref->process_files_from_system();
172 0 $processed++;
173 }
174 1 ▶if (defined $Opt{code}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{"code"}) 1 0 1
175 1 ▶ if ($Opt{auto_semicolon}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Opt{"auto_semicolon"}) 1 0 1
176 1 ▶ unless ($Opt{code} =~ /[;}]\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Opt{"code"} =~ /[;}]\s*$/) 1 0 1
177 1 $Opt{code} .= ';';
178 }
179 }
180 1 $xref->process(\$Opt{code});
181 1 $processed++;
182 }
183 1 ▶if (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) 0 1 1
184 0 $xref->process(@ARGV);
185 0 $processed++;
186 }
187 1 ▶unless ($processed) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($processed) 0 1 1
188 0 die <<__EOF__
189 $ME: Nothing processed: use one of more of:
190 --code=...
191 --files_from_system
192 --files_from_cache
193 filename arguments
194 __EOF__
195 }
196  
197 1 my $t1 = Times->get();
198  
199 6 ▶sub emit {
Subroutine emit: called CC=8 SCAR=22.2
200 6 my ($xref, $opt, $cb) = @_;
201 6 my $fh;
202 6 ▶ if (defined $Opt{report_prefix}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Opt{'report_prefix'}) { } 0 6 6
203 0 my $fn = $Opt{report_prefix} . "$opt.txt";
204 0 ▶ open($fh, ">", $fn) or die qq[$0: Failed to create "$fn": $!\n];
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">", $fn or die qq[$0: Failed to create "$fn": $!\n] 0 0 0
205 0 print "$ME: Created $fn\n";
206 } else {
207 6 $fh = *STDOUT;
208 }
209 6 my $report_title = $Opt{report_title};
210 6 ▶ if (($opt eq 'missing_modules' && !$xref->missing_modules) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($opt eq "missing_modules" and not $xref->missing_modules or $opt eq "parse_errors" and not $xref->parse_errors_files) 2 4 6
Condition77%7/9
$opt eq "missing_modules" and not $xref->missing_modules or $opt eq "parse_errors" and not $xref->parse_errors_files
l!l&&r!l&&!r
114
$opt eq "missing_modules" and not $xref->missing_modules
!ll&&!rl&&r
501
$opt eq "parse_errors" and not $xref->parse_errors_files
!ll&&!rl&&r
401
MC/DC50%2/4
$opt eq "missing_modules" and not $xref->missing_modules or $opt eq "parse_errors" and not $xref->parse_errors_files
$opt eq "missing_modules" not $xref->missing_modules $opt eq "parse_errors" not $xref->parse_errors_files
Truth table42%3/7
A and not(B) or C and not(D)
A= $opt eq "missing_modules"B= not $xref->missing_modulesC= $opt eq "parse_errors"D= not $xref->parse_errors_files
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
211 ($opt eq 'parse_errors' && !$xref->parse_errors_files)) {
212 2 $report_title = 0;
213 }
214 6 ▶ print { $fh } "=== $opt ===\n" if $report_title;
Branch: 1 branch
BranchTrueFalseTotal
if $report_title 4 2 6
215 6 $cb->($xref, $fh);
216 }
217  
218 1 ▶unless ($Opt{parse}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Opt{"parse"}) 1 0 1
219 my %cb = (
220 1 ▶ files => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
221 1 my ($xref, $fh) = @_;
222 1 for my $f ($xref->files) {
223 2 print { $fh } $f, "\n";
224 }
225 },
226 1 ▶ subs => sub{
Subroutine __ANON__: called CC=2 SCAR=6.9
227 1 my ($xref, $fh) = @_;
228 1 for my $s ($xref->subs) {
229 2 print { $fh } $s, "\n";
230 }
231 },
232 0 ▶ packages => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
233 0 my ($xref, $fh) = @_;
234 0 for my $p ($xref->packages) {
235 0 print { $fh } $p, "\n";
236 }
237 },
238 0 ▶ modules => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
239 0 my ($xref, $fh) = @_;
240 0 for my $p ($xref->modules) {
241 0 print { $fh } $p, "\n";
242 }
243 },
244 0 ▶ total_lines => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
245 0 my ($xref, $fh) = @_;
246 0 print { $fh } $xref->total_lines, "\n";
247 },
248 0 ▶ files_lines => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
249 0 my ($xref, $fh) = @_;
250 0 for my $f ($xref->files) {
251 0 print { $fh } $f, $Opt{separator}, $xref->file_lines($f), "\n";
252 }
253 },
254 0 ▶ files_counts => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
255 0 my ($xref, $fh) = @_;
256 0 for my $f ($xref->files) {
257 0 print { $fh } $f, $Opt{separator}, $xref->file_count($f), "\n";
258 }
259 },
260 0 ▶ modules_counts => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
261 0 my ($xref, $fh) = @_;
262 0 for my $f ($xref->modules) {
263 0 print { $fh } $f, $Opt{separator}, $xref->module_count($f), "\n";
264 }
265 },
266 1 ▶ missing_modules => sub {
Subroutine __ANON__: called CC=2 SCAR=9.2
267 1 my ($xref, $fh) = @_;
268 1 for my $m ($xref->missing_modules) {
269 0 print { $fh } $m, $Opt{separator}, $xref->missing_module_count($m), $Opt{separator}, join($Opt{separator}, $xref->missing_module_lines($m)), "\n";
270 }
271 },
272 1 ▶ parse_errors => sub {
Subroutine __ANON__: called CC=4 SCAR=26.2
273 1 my ($xref, $fh) = @_;
274 1 for my $f ($xref->parse_errors_files) {
275 0 my %e = $xref->file_parse_errors($f);
276 0 ▶ my @e = map { defined $e{$_} ? "$e{$_}" : $_ }
Branch: 1 branch
BranchTrueFalseTotal
defined $e{$_} ? : 0 0 0
277 0 ▶ sort { $a cmp $b || $e{$a} cmp $e{$b} }
Condition0%0/3
$a cmp $b || $e{$a} cmp $e{$b}
l!l&&r!l&&!r
000
MC/DC0%0/2
$a cmp $b || $e{$a} cmp $e{$b}
$a cmp $b $e{$a} cmp $e{$b}
Truth table0%0/3
A || B
A= $a cmp $bB= $e{$a} cmp $e{$b}
ABresult
1X1
011
000
278 sort keys %e;
279 0 print { $fh } $f, $Opt{separator}, "@e\n";
280 }
281 },
282 0 ▶ incs_deps => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
283 0 my ($xref, $fh) = @_;
284 0 my $id = $xref->incs_deps;
285 0 for my $f ($id->files) {
286 0 print { $fh } $f, $Opt{separator}, $id->file_kind($f), "\n";
287 }
288 },
289 1 ▶ subs_files => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
290 1 my ($xref, $fh) = @_;
291 my $sfi = $xref->subs_files_iter({separator => $Opt{separator},
292 column => $Opt{column},
293 1 finish => $Opt{finish}});
294 1 ▶ while (my $sf = $sfi->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $sf = $sfi->next) 2 1 3
295 2 print { $fh } $sf->string, "\n";
296 }
297 },
298 0 ▶ packages_files => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
299 0 my ($xref, $fh) = @_;
300 my $pfi = $xref->packages_files_iter({separator => $Opt{separator},
301 column => $Opt{column},
302 0 finish => $Opt{finish}});
303 0 ▶ while (my $pf = $pfi->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $pf = $pfi->next) 0 0 0
304 0 print { $fh } $pf->string, "\n";
305 }
306 },
307 1 ▶ incs_files => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
308 1 my ($xref, $fh) = @_;
309 my $ifi = $xref->incs_files_iter({separator => $Opt{separator},
310 column => $Opt{column},
311 1 finish => $Opt{finish}});
312 1 ▶ while (my $if = $ifi->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $if = $ifi->next) 1 1 2
313 1 print { $fh } $if->string, "\n";
314 }
315 },
316 0 ▶ incs_chains => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
317 0 my ($xref, $fh) = @_;
318 0 my $ici = $xref->incs_chains_iter({separator => $Opt{separator}});
319 0 ▶ while (my $ic = $ici->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ic = $ici->next) 0 0 0
320 0 print { $fh } $ic->string, "\n";
321 }
322 },
323 0 ▶ incs_chains_reverse => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
324 0 my ($xref, $fh) = @_;
325 my $ici = $xref->incs_chains_iter({separator => $Opt{separator},
326 0 reverse_chains => 1});
327 0 ▶ while (my $ic = $ici->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ic = $ici->next) 0 0 0
328 0 print { $fh } $ic->string, "\n";
329 }
330 },
331 1 );
332 1 for my $opt (@ACTION) {
333 16 ▶ if ($Opt{$opt}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Opt{$opt}) 6 10 16
334 6 ▶ die qq[$ME: Unexpected callback '$opt'\n] unless defined $cb{$opt};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cb{$opt} 0 6 6
335 6 emit($xref, $opt, $cb{$opt});
336 }
337 }
338 }
339  
340 1 my $t2 = Times->get();
341  
342 1 ▶if ($Opt{summary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Opt{"summary"}) 0 1 1
343 0 my ($dw1, $du1, $ds1, $dc1) = $t1->diff($t0);
344 0 ▶ printf("$ME: files=%d lines=%d subs=%d\n",
Condition0%0/6
$xref->files || 0
l!l
00
$xref->total_lines || 0
l!l
00
$xref->subs || 0
l!l
00
MC/DC0%0/1
$xref->files || 0
$xref->files
MC/DC0%0/1
$xref->total_lines || 0
$xref->total_lines
MC/DC0%0/1
$xref->subs || 0
$xref->subs
Truth table0%0/2
A
A= $xref->files
Aresult
11
00
Truth table0%0/2
A
A= $xref->total_lines
Aresult
11
00
Truth table0%0/2
A
A= $xref->subs
Aresult
11
00
345 $xref->files || 0,
346 $xref->total_lines || 0,
347 $xref->subs || 0);
348 0 printf("$ME: docs_created=%d cache reads=%d writes=%d updates=%d creates=%d deletes=%d\n",
349 $xref->docs_created,
350 $xref->cache_reads,
351 $xref->cache_writes,
352 $xref->cache_updates,
353 $xref->cache_creates,
354 $xref->cache_deletes);
355 0 printf("$ME: parse: wall=%.2fs user=%.2fs system=%.2fs cpu=%.2fs\n",
356 $dw1, $du1, $ds1, $dc1);
357 0 my ($dw2, $du2, $ds2, $dc2) = $t2->diff($t1);
358 0 printf("$ME: output: wall=%.2fs user=%.2fs system=%.2fs cpu=%.2fs\n",
359 $dw2, $du2, $ds2, $dc2);
360 }
361  
362 1 exit(0);
363  
364 __DATA__
« blib/lib/PPI/Xref.pm ↑ Summary