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