line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Box; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20158
|
use 5.006; use strict; use warnings; |
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
1
|
|
33
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
45
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
869
|
use FindBin; |
|
1
|
|
|
|
|
1112
|
|
|
1
|
|
|
|
|
39
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use File::Basename qw(dirname); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
401
|
use Path::Class; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Class::Maker qw(:all); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Class::Maker::class |
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
public => |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
string => [qw( mother_file boxdir )], |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
hash => [qw( env )], |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _preinit : method |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
my $this = shift; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$this->boxdir( '.box' ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$this->mother_file( __FILE__ ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _postinit : method |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
my $this = shift; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$this->env( { $this->env, |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
HOME => $this->path_home, |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
LOCAL => $this->path_local, |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub path_home : method |
49
|
|
|
|
|
|
|
{ |
50
|
|
|
|
|
|
|
my $this = shift; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $this_file = $this->mother_file; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$this_file =~ s/\.pm$//gi; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $dir = Path::Class::Dir->new( $this_file ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return Path::Class::Dir->new( $dir, $this->boxdir ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub path_local : method |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
my $this = shift; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
return "$FindBin::Bin"; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub request : method |
71
|
|
|
|
|
|
|
{ |
72
|
|
|
|
|
|
|
my $this = shift; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $name = shift; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $path = shift; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
if( not defined($path) ) |
80
|
|
|
|
|
|
|
{ |
81
|
|
|
|
|
|
|
$path = $this->path_home; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
elsif( $path =~ /^__/ ) |
84
|
|
|
|
|
|
|
{ |
85
|
|
|
|
|
|
|
$path =~ s/^__//; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
if( exists $this->env->{$path} ) |
88
|
|
|
|
|
|
|
{ |
89
|
|
|
|
|
|
|
$path = $this->env->{$path}; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else |
92
|
|
|
|
|
|
|
{ |
93
|
|
|
|
|
|
|
Carp::croak "$this->request: Not in 'env': '$path'. Already in 'env' are only ", join( ', ', keys %{ $this->env } ); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
return undef; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Carp::croak 'only FILE|SCALAR are allowed for type' and return undef unless $path; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
return Path::Class::File->new( $path, $name ); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |