line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Number::Object::Filter; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
70
|
use strict; |
|
13
|
|
|
|
|
31
|
|
|
13
|
|
|
|
|
505
|
|
4
|
13
|
|
|
13
|
|
479
|
use warnings; |
|
13
|
|
|
|
|
37
|
|
|
13
|
|
|
|
|
456
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
71
|
use Carp::Clan qw/Number::Object/; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
265
|
|
7
|
13
|
|
|
13
|
|
3321
|
use Class::Inspector; |
|
13
|
|
|
|
|
47
|
|
|
13
|
|
|
|
|
142
|
|
8
|
13
|
|
|
13
|
|
14510
|
use String::CamelCase qw(camelize); |
|
13
|
|
|
|
|
9354
|
|
|
13
|
|
|
|
|
1224
|
|
9
|
13
|
|
|
13
|
|
89
|
use UNIVERSAL::require; |
|
13
|
|
|
|
|
23
|
|
|
13
|
|
|
|
|
154
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
0
|
2
|
sub init {} |
12
|
0
|
|
|
0
|
0
|
0
|
sub filter {} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub execute { |
15
|
6
|
|
|
6
|
0
|
32
|
my($class, $c, $value, @filters) = @_; |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
|
|
10
|
for my $filter (@filters) { |
18
|
9
|
|
|
|
|
21
|
my $pkg = $class->resolve_filter($c, $filter); |
19
|
9
|
50
|
|
|
|
386
|
croak qq{not installed "$filter" filter} unless $pkg; |
20
|
9
|
100
|
|
|
|
29
|
unless (Class::Inspector->loaded($pkg)) { |
21
|
1
|
50
|
|
|
|
74
|
$pkg->require or die $@; |
22
|
1
|
|
|
|
|
18
|
$pkg->init($c); |
23
|
|
|
|
|
|
|
} |
24
|
9
|
|
|
|
|
212
|
$value = $pkg->filter($c, $value); |
25
|
|
|
|
|
|
|
} |
26
|
6
|
|
|
|
|
29
|
$value; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub resolve_filter { |
30
|
9
|
|
|
9
|
0
|
14
|
my($class, $c, $filter) = @_; |
31
|
9
|
|
|
|
|
11
|
my $pkg = ref $c; |
32
|
9
|
|
|
|
|
23
|
$filter = camelize $filter; |
33
|
|
|
|
|
|
|
|
34
|
9
|
|
|
|
|
112
|
for my $f ("$pkg\::Filter::$filter", "Number::Object::Filter::$filter") { |
35
|
9
|
50
|
|
|
|
166
|
return $f if Class::Inspector->installed($f); |
36
|
|
|
|
|
|
|
} |
37
|
0
|
|
|
|
|
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |