lib/Test/File/ShareDir/Object/Inc.pm

filter: Statementstmt 92.5% 37 / 40 Branchbran n/a Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 90.9% 10 / 11 Podpod 100% 3 / 3 totaltotal 89.8% 53 / 59 CC 2 SCAR 2.2
CC
2
Cov
91%
clear
2.0
add_to_inc
2.0
BEGIN
1.0
CRAP 1.3
« lib/Test/File/ShareDir/Module.pm ↑ Summary blib/lib/Test/File/ShareDir/Object/Dist.pm »
1 6 ▶use 5.006; # pragmas
Subroutine BEGIN: called CC=1 SCAR=0.0
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Test::File::ShareDir::Object::Inc;
6  
7 6 our $VERSION = '1.001002';
8  
9 # ABSTRACT: Shared tempdir object code to inject into @INC
10  
11 6 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25 6 my @cache;
26  
27 6 ▶use Class::Tiny {
Subroutine BEGIN: called CC=1 SCAR=0.0
28 5 ▶ tempdir => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
29 5 require Path::Tiny;
30 5 my $dir = Path::Tiny::tempdir( CLEANUP => 1 );
31 5 push @cache, $dir; # explicit keepalive
32 5 return $dir;
33 },
34 3 ▶ module_tempdir => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
35 3 my ($self) = @_;
36 3 my $dir = $self->tempdir->child('auto/share/module');
37 3 $dir->mkpath();
38 3 return $dir->absolute;
39 },
40 2 ▶ dist_tempdir => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
41 2 my ($self) = @_;
42 2 my $dir = $self->tempdir->child('auto/share/dist');
43 2 $dir->mkpath();
44 2 return $dir->absolute;
45 },
46 6 };
47 6 ▶use Carp qw( carp );
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67 0 ▶sub add_to_inc {
Subroutine add_to_inc: not called CC=1 SCAR=6.9
Pod documented
68 0 my ($self) = @_;
69 0 carp 'add_to_inc deprecated sice 1.001000, use register instead';
70 0 return $self->register;
71 }
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85 5 ▶sub register {
Subroutine register: called CC=1 SCAR=0.0
Pod documented
86 5 my ($self) = @_;
87 5 unshift @INC, $self->tempdir->stringify;
88 5 return;
89 }
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103 2 ▶sub clear {
Subroutine clear: called CC=2 SCAR=7.0
Pod documented
104 2 my ($self) = @_;
105 ## no critic (Variables::RequireLocalizedPunctuationVars)
106 2 ▶ @INC = grep { ref or $_ ne $self->tempdir->stringify } @INC;
Condition66%2/3
ref $_ || $_ ne $self->tempdir->stringify
l!l&&r!l&&!r
0162
MC/DC50%1/2
ref $_ || $_ ne $self->tempdir->stringify
ref $_ $_ ne $self->tempdir->stringify
Truth table66%2/3
A || B
A= ref $_B= $_ ne $self->tempdir->stringify
ABresult
1X1
011
000
107 2 return;
108 }
109  
110 6 1;
111  
112 __END__
« lib/Test/File/ShareDir/Module.pm ↑ Summary blib/lib/Test/File/ShareDir/Object/Dist.pm »