From ce992aafb9e583831ccb190a8938145b5e9548e3 Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Mon, 23 Jul 2012 17:06:05 +0000 Subject: [PATCH] Encourage best practice in Perl scripts (use strict, warnings). Backport of r1335882 and r1325724 from trunk. Submitted by: rbowen Reviewed by: rjung, humbedooh Backported by: rjung git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1364713 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 2 ++ STATUS | 6 ------ docs/cgi-examples/printenv | 6 ++++-- support/split-logfile.in | 11 +++++++---- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index f8a696e859..6fc4642137 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,8 @@ Changes with Apache 2.4.3 possible XSS for a site where untrusted users can upload files to a location with MultiViews enabled. [Niels Heinen ] + *) Add "strict" and "warnings" pragmas to Perl scripts. [Rich Bowen] + *) Honor DefaultRuntimeDir for mutexes, socache and CGID socket. [Jim Jagielski] diff --git a/STATUS b/STATUS index a35b6ce86b..964ca71541 100644 --- a/STATUS +++ b/STATUS @@ -135,12 +135,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK: +1: trawick, jorton, rjung +1 before r1364601 was added: jim - * docs+support: Encourage best practice in Perl scripts (use strict, warnings). - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1335882 and - http://svn.apache.org/viewvc?view=revision&revision=1325724 - 2.4.x patch: trunk patch works - +1: rjung, humbedooh, rbowen - * apxs: Make apxs use LDFLAGS from config_vars.mk in addition to CFLAGS and CPPFLAGS. trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1343094 diff --git a/docs/cgi-examples/printenv b/docs/cgi-examples/printenv index f815a7e501..be74feaa82 100644 --- a/docs/cgi-examples/printenv +++ b/docs/cgi-examples/printenv @@ -11,10 +11,12 @@ ## ## printenv -- demo CGI program which just prints its environment ## +use strict; +use warnings; print "Content-type: text/plain; charset=iso-8859-1\n\n"; -foreach $var (sort(keys(%ENV))) { - $val = $ENV{$var}; +foreach my $var (sort(keys(%ENV))) { + my $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; diff --git a/support/split-logfile.in b/support/split-logfile.in index 061162e848..59eda713f9 100644 --- a/support/split-logfile.in +++ b/support/split-logfile.in @@ -26,22 +26,25 @@ # The combined log file is read from stdin. Records read # will be appended to any existing log files. # -%is_open = (); +use strict; +use warnings; -while ($log_line = ) { +my %is_open = (); + +while (my $log_line = ) { # # Get the first token from the log record; it's the # identity of the virtual host to which the record # applies. # - ($vhost) = split (/\s/, $log_line); + my ($vhost) = split (/\s/, $log_line); # # Normalize the virtual host name to all lowercase. # If it's blank, the request was handled by the default # server, so supply a default name. This shouldn't # happen, but caution rocks. # - $vhost = lc ($vhost) or "access"; + $vhost = lc ($vhost) || "access"; # # if the vhost contains a "/" or "\", it is illegal so just use # the default log to avoid any security issues due if it is interprted -- 2.40.0