blib/lib/Mojolicious/Plugin/JIPConf.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran 50.0% 2 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 76.9% 30 / 39 CC 4 SCAR 11.1
CC
4
Cov
77%
register
5.3
__ANON__
2.0
BEGIN
1.0
CRAP 3.0
↑ Summary
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
BranchTrueFalseTotal
unless defined $helper_name and length $helper_name 1 2 3
Condition66%2/3
defined $helper_name and length $helper_name
!ll&&!rl&&r
102
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if $app->can($helper_name) 0 0 0
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__
↑ Summary