line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Config::Find::Where; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.29'; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
74708
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
158
|
|
6
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
108
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
72
|
use Carp; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
297
|
|
9
|
4
|
|
|
4
|
|
19
|
use Config::Find; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
3786
|
|
10
|
|
|
|
|
|
|
our @ISA=@Config::Find::ISA; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub temp_dir { |
13
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
14
|
0
|
|
|
|
|
|
my ($name, $more_name, $create, $dn, $scope)= |
15
|
|
|
|
|
|
|
$class->parse_opts(scope=> 'user', @_); |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
$class->create_dir_if( (defined $dn |
18
|
|
|
|
|
|
|
? $dn |
19
|
|
|
|
|
|
|
: $class->_temp_dir($name, $more_name, $scope)), |
20
|
|
|
|
|
|
|
$create) |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub var_dir { |
24
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
25
|
0
|
|
|
|
|
|
my ($name, $more_name, $create, $dn, $scope)= |
26
|
|
|
|
|
|
|
$class->parse_opts(scope => 'app', @_); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
$class->create_dir_if( (defined $dn |
29
|
|
|
|
|
|
|
? $dn |
30
|
|
|
|
|
|
|
: $class->_var_dir($name, $more_name, $scope) ), |
31
|
|
|
|
|
|
|
$create) |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub bin_dir { |
35
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
36
|
0
|
|
|
|
|
|
my ($name, $more_name, $create, $dn, $scope)= |
37
|
|
|
|
|
|
|
$class->parse_opts(scope=> 'app', @_); |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
$class->create_dir_if( (defined $dn |
40
|
|
|
|
|
|
|
? $dn |
41
|
|
|
|
|
|
|
: $class->_bin_dir($name, $more_name, $scope) ), |
42
|
|
|
|
|
|
|
$create); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub lib_dir { |
46
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
47
|
0
|
|
|
|
|
|
my ($name, $more_name, $create, $dn, $scope) = |
48
|
|
|
|
|
|
|
$class->parse_opts(scope => 'app', @_); |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
$class->create_dir_if( (defined $dn |
51
|
|
|
|
|
|
|
? $dn |
52
|
|
|
|
|
|
|
: $class->_lib_dir($name, $more_name, $scope) ), |
53
|
|
|
|
|
|
|
$create); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub application_dir { |
57
|
0
|
|
|
0
|
1
|
|
my $class=shift; |
58
|
0
|
|
|
|
|
|
my ($name, $more_name, $create, $dn, $scope)= |
59
|
|
|
|
|
|
|
$class->parse_opts(@_); |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
$class->create_dir_if( (defined $dn |
62
|
|
|
|
|
|
|
? $dn |
63
|
|
|
|
|
|
|
: $class->app_dir($name) ), |
64
|
|
|
|
|
|
|
$create) |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub create_dir_if { |
68
|
0
|
|
|
0
|
0
|
|
my ($class, $dir, $create)=@_; |
69
|
|
|
|
|
|
|
# warn ("$class->create_dir($dir, $create)"); |
70
|
0
|
0
|
|
|
|
|
if ($create) { |
71
|
0
|
|
|
|
|
|
$class->create_dir($dir); |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
|
$dir; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_dir { |
77
|
0
|
|
|
0
|
1
|
|
my ($class, $dir)=@_; |
78
|
0
|
|
|
|
|
|
$class->SUPER::create_dir(File::Spec->rel2abs($dir)); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub create_parent_dir { |
82
|
0
|
|
|
0
|
1
|
|
my ($class, $dir)=@_; |
83
|
0
|
|
|
|
|
|
$class->SUPER::create_parent_dir(File::Spec->rel2abs($dir)); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
0
|
1
|
|
sub script_full_path { shift->guess_full_script_name } |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
0
|
1
|
|
sub script_name { shift->guess_script_name } |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
0
|
1
|
|
sub script_dir { shift->guess_script_dir } |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub helper_path { |
93
|
0
|
|
|
0
|
1
|
|
my $class=shift; |
94
|
0
|
|
|
|
|
|
my $helper=shift; |
95
|
0
|
|
|
|
|
|
my $path=$class->bin_dir(@_); |
96
|
0
|
|
|
|
|
|
$class->look_for_helper($path, $helper); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub parse_opts { |
100
|
0
|
|
|
0
|
0
|
|
my ($class, %opts)=@_; |
101
|
0
|
|
|
|
|
|
my ($name, $more_name, $create, $dn, $scope); |
102
|
0
|
|
|
|
|
|
$dn=$opts{dir}; |
103
|
0
|
|
|
|
|
|
$create=$opts{create}; |
104
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
if (defined $opts{name}) { |
106
|
0
|
0
|
|
|
|
|
$opts{name}=~m{^([^/]*)(?:/(.*))?$} |
107
|
|
|
|
|
|
|
or croak "invalid name '$opts{name}' specification"; |
108
|
0
|
|
|
|
|
|
$name=$1; |
109
|
0
|
|
|
|
|
|
$more_name=$2; |
110
|
|
|
|
|
|
|
} else { |
111
|
0
|
|
|
|
|
|
$name=$class->guess_script_name; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
if (defined $opts{scope}) { |
115
|
0
|
0
|
|
|
|
|
if ($opts{scope}=~/^u(ser)?$/i) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$scope='user' |
117
|
|
|
|
|
|
|
} elsif ($opts{scope}=~/^g(lobal)?$/i) { |
118
|
0
|
|
|
|
|
|
$scope='global' |
119
|
|
|
|
|
|
|
} elsif ($opts{scope}=~/^a(pp(lication)?)?$/i) { |
120
|
0
|
|
|
|
|
|
$scope='app' |
121
|
|
|
|
|
|
|
} elsif ($opts{scope}=~/^p(rocess)?$/i) { |
122
|
0
|
|
|
|
|
|
$scope='process' |
123
|
|
|
|
|
|
|
} else { |
124
|
0
|
|
|
|
|
|
croak "invalid option scope => '$opts{scope}'"; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} else { |
127
|
0
|
|
|
|
|
|
$scope='global'; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
return ($name, $more_name, $create, $dn, $scope); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__END__ |