| 1 | package Mojolicious::Plugin::JIPConf; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use JIP::Conf; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | our $VERSION = '0.021'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 4 | ▶ | sub register { | ||||||||||||||||||||||||||
|
Subroutine
register: called CC=4 SCAR=16.8
Pod
documented
| |||||||||||||||||||||||||||||
| 12 | 4 | my ($self, $app, $param_hashref) = @ARG; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 4 | my $helper_name = $param_hashref->{'helper_name'}; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | ▶ | croak q{Bad argument "helper_name"} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $helper_name and length $helper_name
MC/DC50%1/2
defined $helper_name and length $helper_name
defined $helper_name
length $helper_name
Truth table66%2/3
A and B
A= defined $helper_nameB= length $helper_name
| |||||||||||||||||||||||||||||
| 17 | unless defined $helper_name and length $helper_name; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | my $conf = JIP::Conf::init( | ||||||||||||||||||||||||||||
| 20 | 2 | map { $param_hashref->{$_} } qw(path_to_file path_to_variable), | |||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | croak(sprintf q{Plugin "%s" already exists in $app}, $helper_name) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | if $app->can($helper_name); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | $app->helper($helper_name => sub { $conf }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | return $app->$helper_name; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | 1; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | __END__ | ||||||||||||||||||||||||||||