NAME

Egg::Plugin::Filter - Request query is straightened..

SYNOPSIS

# Your control file.
package [MYPROJECT];
use strict;
use Egg qw/-Debug Filter/;

* This is code.

$e->filter( {
  myname => [qw/hold_html abs_strip trim/],
  address=> [qw/hold_html crlf1 abs_strip trim/],
  tel    => [qw/hold phone/],
  } );

my $cookie= $e->filter( {
  nick_name=> [qw/strip_html abs_strip trim/],
  email    => [qw/hold_html hold/],
  }, $e->request->cookies );

DESCRIPTION

This module makes it easy though the code in which the request query is straightened is very annoying.

METHODS

$e->filter([.... ]);

The filter processing is executed.

Filters

trim

Space is erased before and behind the value.

hold

All the space characters are erased.

strip

Space character is replaced with all one space.

hold_tab

All tabs are erased.

strip_tab

Tab is substituted for one space.

abs_strip_tab

Tab is substituted for one space. In addition, the effort to settle the space in one completely is done.

hold_crlf

All crlf are erased.

strip_crlf

crlf is substituted for one space.

abs_strip_crlf

crlf is substituted for one space. In addition, the effort to settle the space in one completely is done.

crlf1

Two or more crlf is adjusted to one.

crlf2

Two or more crlf is adjusted to two.

crlf3

Two or more crlf is adjusted to three.

hold_html

All HTML tag are erased.

strip_html

HTML tag is substituted for one space.

abs_strip_html

HTML tag is substituted for one space. In addition, the effort to settle the space in one completely is done.

escape_html

It invalidates it escaping in HTML Tag.

digit

digits characters is left.

alphanum

alphanumerical character is left.

integer

integer is left.

pos_integer

positive integer is left.

neg_integer

negative integer is left.

decimal

decimal is left.

pos_decimal

positive decimal is left.

neg_decimal

negative decimal is left.

dollars

express dollars like currency is left.

lc

Everything lowercases word.

uc

Everything is replaced with the capital letter.

ucfirst

Only the first character is replaced with the capital letter.

phone

Only the character used for the telephone number is left.

sql_wildcard

The asterisk is replaced with the wild-card for SQL.

quotemeta

It escapes in the meta tag for the regular expression.

Plugin Support

The function to build in the filter of making by oneself as a plugin is supported.

Example:

#
# This is an original filter module.
#
package [MY_FILTER];
use strict;
#
# 'filters' becomes a method to which 'Egg::Plugin::Filter' refers.
#
sub filters {
 {
   # $value = Scalar reference.  $args = Array reference.
   filter1=> sub {
     my($e, $value, $args)= @_;
     .... ban, ban.
     },
   filter2=> sub {
     my($e, $value, $args)= @_;
     .... won, won.
     },
   };
}

#
# Configuration is setup.
#
  plugin_filter=> {
    plugins=> [qw/[MY_FILTER]/],
    },

Complete.

THANKS

It referred to the code of 'HTML::FormValidator' partially.

SEE ALSO

Egg::Release, HTML::FormValidator,

AUTHOR

Masatoshi Mizuno, <mizuno@bomcity.com>

COPYRIGHT AND LICENSE

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