]> granicus.if.org Git - apache/commitdiff
Encourage best practice in Perl scripts (use strict, warnings).
authorRainer Jung <rjung@apache.org>
Mon, 23 Jul 2012 17:06:05 +0000 (17:06 +0000)
committerRainer Jung <rjung@apache.org>
Mon, 23 Jul 2012 17:06:05 +0000 (17:06 +0000)
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
STATUS
docs/cgi-examples/printenv
support/split-logfile.in

diff --git a/CHANGES b/CHANGES
index f8a696e859ec0762350f889f5c98b206b58927f3..6fc46421377dc48122a3bfa934d11de4b6160ab8 100644 (file)
--- 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 <heinenn google.com>]
 
+  *) 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 a35b6ce86bc97d3fd234e4a6e4c5c87422df7ad4..964ca7154161500db4c2dfbd704a13917211e39d 100644 (file)
--- 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
index f815a7e501966fe31c2d3011c5e0b99d2abd17ce..be74feaa82e9bb540f81816e686ecbfcd80b61b6 100644 (file)
 ##
 ##  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";
index 061162e84820e2bfe738217db08154fada73f67e..59eda713f9a64cee7aa56a78e5d3b75be32f331c 100644 (file)
 # 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 = <STDIN>) {
+my %is_open = ();
+
+while (my $log_line = <STDIN>) {
     #
     # 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