| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
6
|
|
|
6
|
|
89074
|
use 5.006; # pragmas |
|
|
6
|
|
|
|
|
14
|
|
|
2
|
6
|
|
|
6
|
|
22
|
use strict; |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
104
|
|
|
3
|
6
|
|
|
6
|
|
17
|
use warnings; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
323
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Test::File::ShareDir; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.001002'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Create a Fake ShareDir for your modules for testing. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
6
|
|
|
6
|
|
2625
|
use File::ShareDir 1.00 qw(); |
|
|
6
|
|
|
|
|
30279
|
|
|
|
6
|
|
|
|
|
128
|
|
|
25
|
6
|
|
|
6
|
|
34
|
use Exporter qw(); |
|
|
6
|
|
|
|
|
7
|
|
|
|
6
|
|
|
|
|
96
|
|
|
26
|
6
|
|
|
6
|
|
2311
|
use Test::File::ShareDir::Utils qw( extract_dashes ); |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
313
|
|
|
27
|
6
|
|
|
6
|
|
28
|
use Carp qw( croak ); |
|
|
6
|
|
|
|
|
7
|
|
|
|
6
|
|
|
|
|
214
|
|
|
28
|
6
|
|
|
6
|
|
2901
|
use parent qw( Exporter ); |
|
|
6
|
|
|
|
|
1444
|
|
|
|
6
|
|
|
|
|
26
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our @EXPORT_OK = qw( with_dist_dir with_module_dir ); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub import { |
|
33
|
5
|
|
|
5
|
|
52
|
my ( $package, @args ) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
5
|
|
|
|
|
4
|
my ( @imports, %params ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# ->import( { }, qw( imports ) ) |
|
38
|
5
|
50
|
|
|
|
16
|
if ( 'HASH' eq ref $args[0] ) { |
|
39
|
0
|
|
|
|
|
0
|
%params = %{ shift @args }; |
|
|
0
|
|
|
|
|
0
|
|
|
40
|
0
|
|
|
|
|
0
|
@imports = @args; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
else { |
|
43
|
|
|
|
|
|
|
# ->import( -arg => value, -arg => value, @imports ); |
|
44
|
5
|
|
|
|
|
16
|
while (@args) { |
|
45
|
7
|
100
|
|
|
|
28
|
if ( $args[0] =~ /\A-(.*)\z/msx ) { |
|
46
|
5
|
|
|
|
|
7
|
$params{ $args[0] } = $args[1]; |
|
47
|
5
|
|
|
|
|
9
|
splice @args, 0, 2, (); |
|
48
|
5
|
|
|
|
|
14
|
next; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
2
|
|
|
|
|
6
|
push @imports, shift @args; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
5
|
100
|
|
|
|
20
|
if ( keys %params ) { |
|
55
|
3
|
|
|
|
|
990
|
require Test::File::ShareDir::TempDirObject; |
|
56
|
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
24
|
my $tempdir_object = Test::File::ShareDir::TempDirObject->new( \%params ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
10
|
for my $module ( $tempdir_object->_module_names ) { |
|
60
|
2
|
|
|
|
|
5
|
$tempdir_object->_install_module($module); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
3
|
|
|
|
|
1992
|
for my $dist ( $tempdir_object->_dist_names ) { |
|
64
|
1
|
|
|
|
|
3
|
$tempdir_object->_install_dist($dist); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
3
|
|
|
|
|
963
|
unshift @INC, $tempdir_object->_tempdir->stringify; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
|
70
|
5
|
100
|
|
|
|
59
|
if (@imports) { |
|
71
|
2
|
|
|
|
|
196
|
$package->export_to_level( 1, undef, @imports ); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
5
|
|
|
|
|
214
|
return; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# This code is just to make sure any guard objects |
|
78
|
|
|
|
|
|
|
# are not lexically visible to the sub they contain creating a self reference. |
|
79
|
|
|
|
|
|
|
sub _mk_clearer { |
|
80
|
2
|
|
|
2
|
|
3
|
my ($clearee) = @_; |
|
81
|
2
|
|
|
2
|
|
22
|
return sub { $clearee->clear }; |
|
|
2
|
|
|
|
|
3330
|
|
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub with_dist_dir { |
|
110
|
1
|
|
|
1
|
1
|
806
|
my ( $config, $code ) = @_; |
|
111
|
1
|
50
|
50
|
|
|
40
|
if ( 'CODE' ne ( ref $code || q{} ) ) { |
|
112
|
0
|
|
0
|
|
|
0
|
croak( 'CodeRef expected at end of with_dist_dir(), ' . ( ref $code || qq{scalar="$code"} ) . ' found' ); |
|
113
|
|
|
|
|
|
|
} |
|
114
|
1
|
|
|
|
|
545
|
require Test::File::ShareDir::Object::Dist; |
|
115
|
1
|
|
|
|
|
385
|
require Scope::Guard; |
|
116
|
1
|
|
|
|
|
357
|
my $dist_object = Test::File::ShareDir::Object::Dist->new( extract_dashes( 'dists', $config ) ); |
|
117
|
1
|
|
|
|
|
65
|
$dist_object->install_all_dists(); |
|
118
|
1
|
|
|
|
|
5
|
$dist_object->register(); |
|
119
|
1
|
|
|
|
|
4
|
my $guard = Scope::Guard->new( _mk_clearer($dist_object) ); ## no critic (Variables::ProhibitUnusedVarsStricter) |
|
120
|
1
|
|
|
|
|
16
|
return $code->(); |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub with_module_dir { |
|
149
|
1
|
|
|
1
|
1
|
31
|
my ( $config, $code ) = @_; |
|
150
|
1
|
50
|
50
|
|
|
22
|
if ( 'CODE' ne ( ref $code || q{} ) ) { |
|
151
|
0
|
|
0
|
|
|
0
|
croak( 'CodeRef expected at end of with_module_dir(), ' . ( ref $code || qq{scalar="$code"} ) . ' found' ); |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
1
|
|
|
|
|
592
|
require Test::File::ShareDir::Object::Module; |
|
155
|
1
|
|
|
|
|
353
|
require Scope::Guard; |
|
156
|
|
|
|
|
|
|
|
|
157
|
1
|
|
|
|
|
279
|
my $module_object = Test::File::ShareDir::Object::Module->new( extract_dashes( 'modules', $config ) ); |
|
158
|
|
|
|
|
|
|
|
|
159
|
1
|
|
|
|
|
64
|
$module_object->install_all_modules(); |
|
160
|
1
|
|
|
|
|
4
|
$module_object->register(); |
|
161
|
1
|
|
|
|
|
4
|
my $guard = Scope::Guard->new( _mk_clearer($module_object) ); ## no critic (Variables::ProhibitUnusedVarsStricter) |
|
162
|
|
|
|
|
|
|
|
|
163
|
1
|
|
|
|
|
13
|
return $code->(); |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
__END__ |