line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Shakan::Filters; |
2
|
23
|
|
|
23
|
|
53741
|
use strict; |
|
23
|
|
|
|
|
43
|
|
|
23
|
|
|
|
|
675
|
|
3
|
23
|
|
|
23
|
|
108
|
use warnings; |
|
23
|
|
|
|
|
36
|
|
|
23
|
|
|
|
|
591
|
|
4
|
23
|
|
|
23
|
|
108
|
use Scalar::Util 'blessed'; |
|
23
|
|
|
|
|
38
|
|
|
23
|
|
|
|
|
5284
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub _get_filter { |
7
|
7
|
|
|
7
|
|
14
|
my $pkg = shift; |
8
|
7
|
50
|
|
|
|
31
|
$pkg = $pkg =~ s/^\+// ? $pkg : "HTML::Shakan::Filter::$pkg"; |
9
|
7
|
|
|
|
|
33
|
Mouse::load_class($pkg); |
10
|
7
|
|
|
|
|
593
|
return $pkg->new(); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub filter { |
14
|
49
|
|
|
49
|
0
|
43538
|
my ($class, $filter_ary, $val) = @_; |
15
|
49
|
100
|
100
|
|
|
276
|
$filter_ary = [$filter_ary] unless (ref $filter_ary||'') eq 'ARRAY'; |
16
|
49
|
|
|
|
|
153
|
for my $filter (@$filter_ary) { |
17
|
8
|
100
|
|
|
|
50
|
unless (blessed $filter) { |
18
|
7
|
|
|
|
|
20
|
$filter = _get_filter($filter); |
19
|
|
|
|
|
|
|
} |
20
|
8
|
|
|
|
|
470
|
$val = $filter->filter($val); |
21
|
|
|
|
|
|
|
} |
22
|
49
|
|
|
|
|
889
|
$val; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |