| HTML-Widget documentation | Contained in the HTML-Widget distribution. |
HTML::Widget::Filter::Callback - Lower Case Filter
my $f = $widget->filter( 'Callback', 'foo' )->callback(sub {
my $value=shift;
$value =~ s/before/after/g;
return $value;
});
Callback Filter.
Lyo Kato, lyo.kato@gmail.com
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| HTML-Widget documentation | Contained in the HTML-Widget distribution. |
package HTML::Widget::Filter::Callback; use warnings; use strict; use base 'HTML::Widget::Filter'; __PACKAGE__->mk_accessors(qw/callback/); *cb = \&callback;
sub filter { my ( $self, $value ) = @_; my $callback = $self->callback || sub { $_[0] }; return $callback->($value); }
1;