line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::ModuleMaker::MockHomeDir; |
2
|
|
|
|
|
|
|
# Adapted from CPAN-Reporter's t/lib/MockHomeDir.pm |
3
|
17
|
|
|
17
|
|
1245
|
use 5.006001; |
|
17
|
|
|
|
|
50
|
|
4
|
17
|
|
|
17
|
|
70
|
use strict; |
|
17
|
|
|
|
|
37
|
|
|
17
|
|
|
|
|
314
|
|
5
|
17
|
|
|
17
|
|
80
|
use warnings; |
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
587
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.63"; |
7
|
17
|
|
|
17
|
|
92
|
use File::Spec; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
524
|
|
8
|
17
|
|
|
17
|
|
96
|
use File::Path 2.15 qw(make_path); |
|
17
|
|
|
|
|
262
|
|
|
17
|
|
|
|
|
661
|
|
9
|
17
|
|
|
17
|
|
637
|
use File::Temp qw/tempdir/; |
|
17
|
|
|
|
|
13291
|
|
|
17
|
|
|
|
|
6145
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $testlib_dir = File::Spec->catdir(qw| . t testlib |); |
12
|
|
|
|
|
|
|
my @components = qw| ExtUtils ModuleMaker Testing Defaults |; |
13
|
|
|
|
|
|
|
my $package = join('::' => @components); |
14
|
|
|
|
|
|
|
my $per_package = join('::' => @components[0..1], 'Personal', $components[3]); |
15
|
|
|
|
|
|
|
my @pmfile_components = (@components[0..2], "$components[3].pm"); |
16
|
|
|
|
|
|
|
my $testing_defaults_file = |
17
|
|
|
|
|
|
|
File::Spec->catfile($testlib_dir, @pmfile_components); |
18
|
|
|
|
|
|
|
die "Could not locate $testing_defaults_file" unless -f $testing_defaults_file; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
unshift @INC, $testlib_dir; |
21
|
|
|
|
|
|
|
eval "require $package" or die "Unable"; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$INC{"File/HomeDir.pm"} = 1; # fake load |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $temp_home = tempdir( |
26
|
|
|
|
|
|
|
"ModuleMaker-XXXXXXXX", TMPDIR => 1, CLEANUP => 1 |
27
|
|
|
|
|
|
|
) or die "Couldn't create a temporary config directory: $!\nIs your temp drive full?"; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $home_dir = File::Spec->rel2abs( $temp_home ); |
30
|
|
|
|
|
|
|
my $subdir = '.modulemaker'; |
31
|
|
|
|
|
|
|
my $personal_defaults_dir = |
32
|
|
|
|
|
|
|
File::Spec->catdir($home_dir, $subdir, qw| ExtUtils ModuleMaker Personal | ); |
33
|
|
|
|
|
|
|
make_path($personal_defaults_dir, { mode => 0711 }); |
34
|
|
|
|
|
|
|
die "Unable to create $personal_defaults_dir for testing" |
35
|
|
|
|
|
|
|
unless -d $personal_defaults_dir; |
36
|
|
|
|
|
|
|
|
37
|
56
|
|
|
56
|
0
|
454
|
sub home_dir { $home_dir } |
38
|
55
|
|
|
55
|
0
|
398
|
sub personal_defaults_dir { $personal_defaults_dir } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub personal_defaults_file { |
41
|
3
|
|
|
3
|
0
|
1087
|
my $newfile = File::Spec->catfile($personal_defaults_dir, 'Defaults.pm'); |
42
|
3
|
50
|
|
|
|
251
|
open my $OUT, '>', $newfile or die "Unable to open $newfile for writing"; |
43
|
3
|
|
|
|
|
19
|
print $OUT <
|
44
|
|
|
|
|
|
|
package $per_package; |
45
|
|
|
|
|
|
|
use strict; |
46
|
|
|
|
|
|
|
use warnings; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my \$usage = <
|
49
|
|
|
|
|
|
|
TOP_OF_PACKAGE |
50
|
3
|
|
|
|
|
21
|
print $OUT ExtUtils::ModuleMaker::Testing::Defaults::get_usage_as_string(); |
51
|
3
|
|
|
|
|
24
|
print $OUT <
|
52
|
|
|
|
|
|
|
ENDOFUSAGE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my \%default_values = ( |
55
|
|
|
|
|
|
|
MIDDLE_OF_PACKAGE |
56
|
3
|
|
|
|
|
14
|
print $OUT ExtUtils::ModuleMaker::Testing::Defaults::get_default_values_as_string(); |
57
|
3
|
|
|
|
|
294
|
print $OUT <
|
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub default_values { |
61
|
|
|
|
|
|
|
my \$self = shift; |
62
|
|
|
|
|
|
|
return { %default_values }; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
BOTTOM_OF_PACKAGE |
67
|
3
|
50
|
|
|
|
96
|
close $OUT or die "Unable to close $newfile after writing"; |
68
|
3
|
|
|
|
|
18
|
return $newfile; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
package File::HomeDir; |
72
|
|
|
|
|
|
|
our $VERSION = 999; |
73
|
17
|
|
|
17
|
|
117
|
no warnings 'redefine'; |
|
17
|
|
|
|
|
35
|
|
|
17
|
|
|
|
|
825
|
|
74
|
101
|
|
|
101
|
1
|
577
|
sub my_home { return $home_dir }; |
75
|
17
|
|
|
17
|
|
90
|
use warnings; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
689
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|