line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pickles::Util; |
2
|
12
|
|
|
12
|
|
62
|
use strict; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
375
|
|
3
|
12
|
|
|
12
|
|
8535
|
use Path::Class; |
|
12
|
|
|
|
|
542251
|
|
|
12
|
|
|
|
|
925
|
|
4
|
12
|
|
|
12
|
|
111
|
use base qw(Exporter); |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
1151
|
|
5
|
12
|
|
|
12
|
|
87
|
use Carp (); |
|
12
|
|
|
|
|
24
|
|
|
12
|
|
|
|
|
15016
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw(env_name env_value); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub env_name { |
11
|
35
|
|
|
35
|
0
|
82
|
my( $name, $appname ) = @_; |
12
|
35
|
|
|
|
|
195
|
$appname =~ s/::/_/g; |
13
|
35
|
|
|
|
|
274
|
return uc(join('_', $appname, $name)); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub env_value { |
17
|
35
|
|
|
35
|
0
|
449
|
return $ENV{ env_name(@_) }; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub appname { |
21
|
32
|
|
|
32
|
0
|
73
|
my $class = shift; |
22
|
32
|
50
|
|
|
|
152
|
if (my $appname = $ENV{PICKLES_APPNAME}) { |
23
|
0
|
|
|
|
|
0
|
return $appname; |
24
|
|
|
|
|
|
|
} |
25
|
32
|
50
|
|
|
|
352
|
if ( $class =~ m/^(.*?)::(Context|Config)$/ ) { |
26
|
32
|
|
|
|
|
115
|
my $appname = $1; |
27
|
32
|
|
|
|
|
199
|
return $appname; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
Carp::croak("Could not determine APPNAME from either %ENV or classname ($class)"); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |