Merge/SimpleScopeGuard.pm

filter: Statementstmt 81.4% 22 / 27 Branchbran 50.0% 1 / 2 Conditioncond 28.5% 2 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.7% 6 / 7 Podpod 100% 2 / 2 totaltotal 67.3% 33 / 49 CC 6 SCAR 13.2
CC
6
Cov
69%
add_files
6.0
cleanup
5.6
BEGIN
1.0
CRAP 3.7
« Merge.pm ↑ Summary
1 package Parse::ExuberantCTags::Merge::SimpleScopeGuard;
2  
3 2 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '1.00';
8  
9 use Class::XSAccessor
10 2 ▶ constructor => 'new',
Subroutine BEGIN: called CC=1 SCAR=0.0
11 accessors => {
12 files => 'files',
13 2 };
14  
15 0 ▶sub add_files {
Subroutine add_files: not called CC=2 SCAR=17.9
Pod documented
16 0 my $self = shift;
17 0 ▶ my $files = $self->files || [];
Condition0%0/2
$self->files || []
l!l
00
MC/DC0%0/1
$self->files || []
$self->files
Truth table0%0/2
A
A= $self->files
Aresult
11
00
18  
19 0 push @$files, @_;
20 0 $self->files($files);
21 0 return(1);
22 }
23  
24 11 ▶sub cleanup {
Subroutine cleanup: called CC=5 SCAR=17.2
Pod documented
25 11 my $self = shift;
26 11 ▶ foreach my $file ( @{$self->files || []} ) {
Condition50%1/2
$self->files || []
l!l
110
MC/DC0%0/1
$self->files || []
$self->files
Truth table50%1/2
A
A= $self->files
Aresult
11
00
27 2 ▶ if (defined $file and -f $file) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $file and -f $file) 2 0 2
Condition33%1/3
defined $file and -f $file
!ll&&!rl&&r
002
MC/DC0%0/2
defined $file and -f $file
defined $file -f $file
Truth table33%1/3
A and B
A= defined $fileB= -f $file
ABresult
0X0
100
111
28 2 unlink $file;
29 }
30 }
31 11 $self->files([]);
32 11 return();
33 }
34  
35 11 ▶sub DESTROY {
Subroutine DESTROY: called CC=1 SCAR=0.0
36 11 my $self = shift;
37 11 $self->cleanup;
38 }
39  
40 2 1;
41 __END__
« Merge.pm ↑ Summary