line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::JIPConf; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1679
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
8145
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1261
|
use JIP::Conf; |
|
1
|
|
|
|
|
1654
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
14
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
7
|
1
|
|
|
1
|
|
4
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub register { |
12
|
4
|
|
|
4
|
1
|
5401
|
my ($self, $app, $param_hashref) = @ARG; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
15
|
my $helper_name = $param_hashref->{'helper_name'}; |
15
|
|
|
|
|
|
|
|
16
|
3
|
100
|
66
|
|
|
179
|
croak q{Bad argument "helper_name"} |
17
|
|
|
|
|
|
|
unless defined $helper_name and length $helper_name; |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
10
|
my $conf = JIP::Conf::init( |
20
|
2
|
|
|
|
|
4
|
map { $param_hashref->{$_} } qw(path_to_file path_to_variable), |
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__ |