From: Martin Mares Date: Mon, 14 Sep 2015 10:46:53 +0000 (+0200) Subject: UCW::CGI: Added an option for preserving whitespaces in arguments X-Git-Tag: v6.5.2~8 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=cad1b1c61b6859d2f1785691f898bbf22851d52c;p=libucw.git UCW::CGI: Added an option for preserving whitespaces in arguments --- diff --git a/ucw/perl/UCW/CGI.pm b/ucw/perl/UCW/CGI.pm index de39d226..f31f31a5 100644 --- a/ucw/perl/UCW/CGI.pm +++ b/ucw/perl/UCW/CGI.pm @@ -1,6 +1,6 @@ # Poor Man's CGI Module for Perl # -# (c) 2002--2011 Martin Mares +# (c) 2002--2015 Martin Mares # Slightly modified by Tomas Valla # # This software may be freely distributed and used according to the terms @@ -187,8 +187,10 @@ sub parse_args($) { # CAVEAT: attached files must be defined in the main arg t defined($raw_args{$arg}) or next; for (@{$raw_args{$arg}}) { $a->{'multiline'} or s/(\n|\t)/ /g; - s/^\s+//; - s/\s+$//; + unless ($a->{'preserve_spaces'}) { + s/^\s+//; + s/\s+$//; + } if (my $rx = $a->{'check'}) { if (!/^$rx$/) { $_ = $a->{'default'}; } }