Egg::Plugin::Filter - Plugin to regularize input data.
use Egg qw/ Filter /; # The received form data is filtered. $e->filter( myname => [qw/ hold_html abs_strip trim /], address=> [qw/ hold_html crlf:2 abs_strip trim /], tel => [qw/ hold phone /], ); # Cookie is filtered. my $cookie= $e->filter( { nick_name=> [qw/ strip_html abs_strip trim /], email => [qw/ hold_html hold /], }, $e->request->cookies );
It is a plugin target to remove the problem part from data input to the form.
An original filter can be defined in %Filters.
package MyApp; use Egg qw/ Filter /; { my $filter= \%Egg::Plugin::Filter::Filters; $filter->{myfilter}= sub { my($e, $value, $arg)= @_; .......... ... }; };
Those filters cannot be used when overwriting because the filter of default is defined in %Filters beforehand.
The name of the defined key becomes the name of the filter.
The object of the project and the value of the object parameter are passed for the set CODE reference. Moreover, when it is being made to have in the argument by the filter, it is passed by the third element.
There is especially no return value needing.
The filter is processed.
ATTR_HASH is a filter setting, and the key is a name of the processed parameter. The value enumerates the name of the filter with ARRAY.
$e->filter( param_name1 => [qw/ strip space trim /], param_name2 => [qw/ strip_html space trim /], param_name3 => [qw/ strip_html crlf:3 trim /], );
The thing that connects the values of the parameter and processes it can be done.
$e->filter( 'anyparam[qw/ param_name1 param_name2 /]' => [qw/ strip space trim /], );
It is processed being made 'anyparam' to connect 'param_name1' and 'param_name2' by this.
When the argument can be given to the filter, the argument can be passed according to points like the connection of parameters.
$e->filter( param1 => ["regex['^\s+', '\s+$]"], );
The processed parameter is passed to PARAM_HASH. When this is unspecification, $e->request->params is used.
The space character in the back and forth is deleted.
The space character is completely deleted.
It is 'hold' in the object only as for changing line and the tab.
The tab is deleted.
Consecutive half angle space is settled in one.
Alias is 'hold_space'.
The character string seen the HTML tag is deleted.
The continuousness of the space character is substituted for one half angle space.
The continuousness of half angle space is substituted for one half angle space.
Alias is 'strip_space'.
Continuousness in the tab is substituted for one half angle space.
The character string seen the HTML tag is substituted for one half angle space.
It is 'strip' for changing line and the tab.
A consecutive changing line is settled in NUM piece. The tab is deleted.
Default when NUM is omitted is 2.
param1 => [qw/ crlf[3] /]
It is 'encode_entities' of HTML::Entities.
It deletes it excluding the normal-width figure.
It deletes it excluding the alphanumeric character.
It deletes it excluding the integer.
It deletes it excluding the positive integer.
It deletes it excluding the negative integer.
It deletes it excluding the integer including small number of people.
It deletes it excluding a positive integer including small number of people.
It deletes it excluding a negative integer including small number of people.
It deletes it excluding the figure that can be used with dollar currency.
The character that cannot be used by the telephone number is deleted.
'*' is substituted for '%'.
Quotemeta is done.
uc is done.
ucfirst is done.
lc is done.
The domain name part in the mail address is converted into the small letter.
MyName@DOMAIN.COM => MyName@domain.com
Alias is 'email'.
The domain name part of URL is converted into the small letter.
http://MYDOMAIN.COM/Hoge/Boo.html => http://mydomain.com/Hoge/Boo.html
Alias is 'url'.
The part that matches to the regular expression specified for REGEXP is deleted. REGEXP is two or more contact.
param1 => ["regex['abc', 'xyz']"],
Egg::Release, HTML::Entities, URI,
Masatoshi Mizuno <lushe@cpan.org>
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install Egg::Release, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Egg::Release
CPAN shell
perl -MCPAN -e shell install Egg::Release
For more information on module installation, please visit the detailed CPAN module installation guide.