line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Namespace::perl; |
2
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
220
|
use Catmandu::Sane; |
|
28
|
|
|
|
|
74
|
|
|
28
|
|
|
|
|
376
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
28
|
|
|
28
|
|
235
|
use Catmandu::Util qw(is_instance require_package); |
|
28
|
|
|
|
|
69
|
|
|
28
|
|
|
|
|
1906
|
|
8
|
28
|
|
|
28
|
|
12677
|
use String::CamelCase qw(camelize); |
|
28
|
|
|
|
|
15441
|
|
|
28
|
|
|
|
|
1696
|
|
9
|
28
|
|
|
28
|
|
223
|
use Moo; |
|
28
|
|
|
|
|
61
|
|
|
28
|
|
|
|
|
235
|
|
10
|
28
|
|
|
28
|
|
11749
|
use namespace::clean; |
|
28
|
|
|
|
|
74
|
|
|
28
|
|
|
|
|
309
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Namespace'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub load { |
15
|
430
|
|
|
430
|
0
|
1291
|
my ($self, $name, $args, $type) = @_; |
16
|
430
|
|
|
|
|
1860
|
my $ns = join('::', map {camelize($_)} split(/\./, $self->name)); |
|
860
|
|
|
|
|
7079
|
|
17
|
430
|
100
|
|
|
|
4843
|
$ns = join('::', $ns, $type) if $type; |
18
|
|
|
|
|
|
|
|
19
|
430
|
|
|
|
|
669
|
my $pkg; |
20
|
|
|
|
|
|
|
try { |
21
|
430
|
|
|
430
|
|
41578
|
$pkg = require_package($name, $ns); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
catch_case [ |
24
|
|
|
|
|
|
|
'Catmandu::NoSuchPackage' => sub { |
25
|
3
|
|
|
3
|
|
1353
|
Catmandu::NoSuchFixPackage->throw( |
26
|
|
|
|
|
|
|
message => "No such fix package: $name", |
27
|
|
|
|
|
|
|
package_name => $_->package_name, |
28
|
|
|
|
|
|
|
fix_name => $name, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
}, |
31
|
430
|
|
|
|
|
3432
|
]; |
32
|
|
|
|
|
|
|
try { |
33
|
427
|
|
|
427
|
|
38220
|
$pkg->new(@$args); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
catch { |
36
|
2
|
50
|
|
2
|
|
775
|
$_->throw if is_instance($_, 'Catmandu::Error'); |
37
|
2
|
|
|
|
|
65
|
Catmandu::BadFixArg->throw( |
38
|
|
|
|
|
|
|
message => $_, |
39
|
|
|
|
|
|
|
package_name => $pkg, |
40
|
|
|
|
|
|
|
fix_name => $name, |
41
|
|
|
|
|
|
|
); |
42
|
427
|
|
|
|
|
12491
|
}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |