line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::ProjectHome; |
2
|
2
|
|
|
2
|
|
21877
|
use 5.008005; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
88
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
76
|
|
4
|
2
|
|
|
2
|
|
23
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
78
|
|
5
|
2
|
|
|
2
|
|
12
|
use File::Spec; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
69
|
|
6
|
2
|
|
|
2
|
|
2108
|
use Path::Class qw(dir); |
|
2
|
|
|
|
|
124409
|
|
|
2
|
|
|
|
|
547
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @PROJECT_ROOT_FILES = qw( |
11
|
|
|
|
|
|
|
cpanfile |
12
|
|
|
|
|
|
|
.git |
13
|
|
|
|
|
|
|
.gitmodules |
14
|
|
|
|
|
|
|
Makefile.PL |
15
|
|
|
|
|
|
|
Build.PL |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub project_home { |
19
|
1
|
|
|
1
|
0
|
24
|
my $dir = dir((caller)[1]); |
20
|
1
|
|
|
|
|
183
|
while (my $parent = _parent($dir)) { |
21
|
3
|
|
|
|
|
22
|
for my $project_root_files (@PROJECT_ROOT_FILES) { |
22
|
11
|
100
|
|
|
|
287
|
if (-e File::Spec->catfile($dir, $project_root_files)) { |
23
|
1
|
|
|
|
|
40
|
return "$dir"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
2
|
|
|
|
|
62
|
$dir = $parent; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _parent { |
31
|
3
|
|
|
3
|
|
4
|
my $dir = shift; |
32
|
3
|
|
|
|
|
12
|
my $parent = $dir->parent; |
33
|
3
|
50
|
|
|
|
324
|
return if $parent eq File::Spec->rootdir; |
34
|
3
|
|
|
|
|
58
|
return $parent; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |