X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FCGI%2FEx%2FValidate.pm;h=9299a5e916a80042f0040a7bca5054a783ae2982;hb=d0287461de3f9b5c49ce02b22957022bdc5e87d8;hp=77ebd2a4ea7c7f00160d0d3bde73fb84ab1cb6f3;hpb=48c4840be1f154e262de2c161cb86dc5000dfe47;p=chaz%2Fp5-CGI-Ex diff --git a/lib/CGI/Ex/Validate.pm b/lib/CGI/Ex/Validate.pm index 77ebd2a..9299a5e 100644 --- a/lib/CGI/Ex/Validate.pm +++ b/lib/CGI/Ex/Validate.pm @@ -7,7 +7,7 @@ CGI::Ex::Validate - another form validator - but it does javascript in parallel =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -22,7 +22,7 @@ use vars qw($VERSION @UNSUPPORTED_BROWSERS ); -$VERSION = '2.05'; +$VERSION = '2.07'; $DEFAULT_EXT = 'val'; $QR_EXTRA = qr/^(\w+_error|as_(array|string|hash)_\w+|no_\w+)/; @@ -303,6 +303,11 @@ sub validate_buddy { $value =~ s/\s+$//; $modified = 1; } + if ($field_val->{'trim_control_chars'}) { + $value =~ y/\t/ /; + $value =~ y/\x00-\x1F//d; + $modified = 1; + } if ($field_val->{'to_upper_case'}) { # uppercase $value = uc($value); $modified = 1; @@ -1721,6 +1726,13 @@ not trim. {field => 'foo', do_not_trim => 1} +=item C + +Off by default. If set to true, removes characters in the +\x00 to \x31 range (Tabs are translated to a single space). + + {field => 'foo', trim_control_chars => 1} + =item C Pass a swap pattern to change the actual value of the form.