From cad1b1c61b6859d2f1785691f898bbf22851d52c Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 14 Sep 2015 12:46:53 +0200 Subject: [PATCH] UCW::CGI: Added an option for preserving whitespaces in arguments --- ucw/perl/UCW/CGI.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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'}; } } -- 2.39.5