line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Filter; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
661
|
use warnings; |
|
88
|
|
|
|
|
198
|
|
|
88
|
|
|
|
|
2696
|
|
4
|
88
|
|
|
88
|
|
470
|
use strict; |
|
88
|
|
|
|
|
193
|
|
|
88
|
|
|
|
|
2672
|
|
5
|
88
|
|
|
88
|
|
458
|
use base 'Class::Accessor::Chained::Fast'; |
|
88
|
|
|
|
|
185
|
|
|
88
|
|
|
|
|
33937
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/names/); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
HTML::Widget::Filter - Filter Base Class |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $f = $widget->filter( $type, @names ); |
16
|
|
|
|
|
|
|
$c->names(@names); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Filter Base Class. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 filter |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Arguments: $value |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Return Value: $filtered_value |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
FIlter given value. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
0
|
sub filter { return $_[0] } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 init |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Arguments: $widget |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Called once when process() gets called for the first time. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
30
|
|
|
30
|
1
|
92
|
sub init { } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 names |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Arguments: @names |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Return Value: @names |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Contains names of params to filter. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 prepare |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Arguments: $widget |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Called whenever process() gets called. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
11
|
|
|
11
|
1
|
29
|
sub prepare { } |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 process |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Arguments: \%params, \@uploads |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub process { |
71
|
11
|
|
|
11
|
1
|
35
|
my ( $self, $params ) = @_; |
72
|
11
|
100
|
|
|
|
122
|
my @names = scalar @{ $self->names } ? @{ $self->names } : keys %$params; |
|
11
|
|
|
|
|
81
|
|
|
10
|
|
|
|
|
121
|
|
73
|
11
|
|
|
|
|
107
|
for my $name (@names) { |
74
|
12
|
|
|
|
|
63
|
my $values = $params->{$name}; |
75
|
12
|
100
|
|
|
|
49
|
if ( ref $values eq 'ARRAY' ) { |
76
|
2
|
|
|
|
|
6
|
$params->{$name} = [ map { $self->filter($_); } @$values ]; |
|
4
|
|
|
|
|
26
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else { |
79
|
10
|
|
|
|
|
75
|
$params->{$name} = $self->filter($values); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Sebastian Riedel, C |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 LICENSE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
91
|
|
|
|
|
|
|
the same terms as Perl itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |