line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Filter::Callback; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
82024
|
use warnings; |
|
88
|
|
|
|
|
245
|
|
|
88
|
|
|
|
|
2934
|
|
4
|
88
|
|
|
88
|
|
514
|
use strict; |
|
88
|
|
|
|
|
276
|
|
|
88
|
|
|
|
|
3813
|
|
5
|
88
|
|
|
88
|
|
545
|
use base 'HTML::Widget::Filter'; |
|
88
|
|
|
|
|
312
|
|
|
88
|
|
|
|
|
18049
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/callback/); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
*cb = \&callback; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
HTML::Widget::Filter::Callback - Lower Case Filter |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $f = $widget->filter( 'Callback', 'foo' )->callback(sub { |
18
|
|
|
|
|
|
|
my $value=shift; |
19
|
|
|
|
|
|
|
$value =~ s/before/after/g; |
20
|
|
|
|
|
|
|
return $value; |
21
|
|
|
|
|
|
|
}); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Callback Filter. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 callback |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Argument: \&callback |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Define the callback to be used for filter. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
L is an alias for L. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 filter |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub filter { |
42
|
5
|
|
|
5
|
1
|
10
|
my ( $self, $value ) = @_; |
43
|
5
|
|
50
|
0
|
|
14
|
my $callback = $self->callback || sub { $_[0] }; |
|
0
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
40
|
return $callback->($value); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 AUTHOR |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Lyo Kato, C |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 LICENSE |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
54
|
|
|
|
|
|
|
the same terms as Perl itself. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |