line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::JIPConf; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2024
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
8093
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1215
|
use JIP::Conf; |
|
1
|
|
|
|
|
1873
|
|
|
1
|
|
|
|
|
35
|
|
6
|
1
|
|
|
1
|
|
17
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
7
|
1
|
|
|
1
|
|
4
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub register { |
12
|
4
|
|
|
4
|
1
|
4201
|
my ($self, $app, $param_hashref) = @ARG; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
13
|
my $helper_name = $param_hashref->{'helper_name'}; |
15
|
|
|
|
|
|
|
|
16
|
3
|
100
|
66
|
|
|
274
|
croak q{Bad argument "helper_name"} |
17
|
|
|
|
|
|
|
unless defined $helper_name and length $helper_name; |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
11
|
my $conf = JIP::Conf::init( |
20
|
2
|
|
|
|
|
2
|
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__ |