NAME

Egg::Plugin::Filter - Filter of request query for Egg plugin.

SYNOPSIS

  use Egg qw/ Filter /;

  # The received form data is filtered.
  $e->filter(
   myname => [qw/hold_html abs_strip trim/],
   address=> [qw/hold_html crlf1 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 );

DESCRIPTION

It is filter plugin to pass it as for data.

FILTERS

trim

The space character in the back and forth is deleted.

hold

The space character is deleted.

strip

The continuousness of the space character is substituted for one half angle space.

hold_tab

The tab is deleted.

space

Consecutive half angle space is settled in one.

crlf:[NUM]

A consecutive changing line is settled in [NUM] piece. * The tab is deleted.

Default when [NUM] is omitted is 1.

strip_tab

Continuousness in the tab is substituted for one half angle space.

hold_crlf

It is 'hold' for changing line and the tab.

strip_crlf

It is 'strip' for changing line and the tab.

hold_html

The character string seen the HTML tag is deleted.

strip_html

The character string seen the HTML tag is substituted for one half angle space.

escape_html

HTML::Entities::encode_entities is done.

digit

It deletes it excluding the normal-width figure.

alphanum

It deletes it excluding the alphanumeric character.

integer

It deletes it excluding the integer.

pos_integer

It deletes it excluding the positive integer.

neg_integer

It deletes it excluding the negative integer.

decimal

It deletes it excluding the integer including small number of people.

pos_decimal

It deletes it excluding a positive integer including small number of people.

neg_decimal

It deletes it excluding a negative integer including small number of people.

dollars

It deletes it excluding the figure that can be used with dollar currency.

lc

lc is done.

uc

uc is done.

ucfirst

ucfirst is done.

phone

The character that cannot be used by the telephone number is deleted.

sql_wildcard

'*' is substituted for '%'.

quotemeta

quotemeta is done.

CONFIGURATION

It is possible to set it by 'plugin_filter' as follows.

plugins => [PLUGIN_ARRAY]

List of plugin module to enhance filter.

The specified name is progressed and treated with 'Egg::Plugin::Filter::[PLUGIN_NAME]' usually. When + is applied to the head, the name is treated as it is as a module name.

  plugins => [qw/ Japanese::EUC /],

METHODS

filter ( [ATTR_HASH], [TARGET_PARAM] )

The filter is processed according to ATTR_HASH, and the result is returned.

When TARGET_PARAM is omitted, $e->request->params is used.

Please set the list of the filter name to the parameter name of the object about ATTR_HASH.

  $e->filter(
    param_name1 => [qw/ strip space trim /],
    param_name2 => [qw/ strip_html space trim /],
    param_name3 => [qw/ strip_html crlf:3 trim /],
    );

SEE ALSO

HTML::Entities, Egg::Request, Egg::Release,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT

Copyright (C) 2007 by 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.