Catmandu/Fix/Namespace/perl.pm

filter: Statementstmt 100% 30 / 30 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 95.5% 43 / 45 CC 3 SCAR 3.0
CC
3
Cov
97%
__ANON__
2.1
load
2.0
BEGIN
1.0
CRAP 1.3
« Catmandu/Fix/error.pm ↑ Summary Catmandu/Fix/add_to_store.pm »
1 package Catmandu::Fix::Namespace::perl;
2  
3 28 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 28 our $VERSION = '1.2025';
6  
7 28 ▶use Catmandu::Util qw(is_instance require_package);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 28 ▶use String::CamelCase qw(camelize);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 28 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 28 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 28 with 'Catmandu::Fix::Namespace';
13  
14 430 ▶sub load {
Subroutine load: called CC=2 SCAR=6.9
Pod undocumented
15 430 my ($self, $name, $args, $type) = @_;
16 430 my $ns = join('::', map {camelize($_)} split(/\./, $self->name));
17 430 ▶ $ns = join('::', $ns, $type) if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 197 233 430
18  
19 430 my $pkg;
20 430 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
21 430 $pkg = require_package($name, $ns);
22 }
23 catch_case [
24 3 ▶ 'Catmandu::NoSuchPackage' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
25 3 Catmandu::NoSuchFixPackage->throw(
26 message => "No such fix package: $name",
27 package_name => $_->package_name,
28 fix_name => $name,
29 );
30 },
31 430 ];
32 427 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 427 $pkg->new(@$args);
34 }
35 2 ▶ catch {
Subroutine __ANON__: called CC=2 SCAR=7.2
36 2 ▶ $_->throw if is_instance($_, 'Catmandu::Error');
Branch: 1 branch
BranchTrueFalseTotal
if is_instance($_, "Catmandu::Error") 0 2 2
37 2 Catmandu::BadFixArg->throw(
38 message => $_,
39 package_name => $pkg,
40 fix_name => $name,
41 );
42 427 };
43 }
44  
45 28 1;
« Catmandu/Fix/error.pm ↑ Summary Catmandu/Fix/add_to_store.pm »