line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::JIPConf; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2596
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
103122
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1258
|
use JIP::Conf; |
|
1
|
|
|
|
|
1451
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
1
|
|
|
1
|
|
5
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.021'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub register { |
12
|
4
|
|
|
4
|
1
|
7464
|
my ($self, $app, $param_hashref) = @ARG; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
15
|
my $helper_name = $param_hashref->{'helper_name'}; |
15
|
|
|
|
|
|
|
|
16
|
3
|
100
|
66
|
|
|
197
|
croak q{Bad argument "helper_name"} |
17
|
|
|
|
|
|
|
unless defined $helper_name and length $helper_name; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $conf = JIP::Conf::init( |
20
|
2
|
|
|
|
|
5
|
map { $param_hashref->{$_} } qw(path_to_file path_to_variable), |
|
4
|
|
|
|
|
12
|
|
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
croak(sprintf q{Plugin "%s" already exists in $app}, $helper_name) |
24
|
|
|
|
|
|
|
if $app->can($helper_name); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
|
|
$app->helper($helper_name => sub { $conf }); |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
return $app->$helper_name; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |