W3C home > Mailing lists > Public > www-validator@w3.org > September 2008

checklink: local variable names

From: Michael Ernst <mernst@alum.mit.edu>
Date: Tue, 30 Sep 2008 09:27:48 +0200
Message-ID: <18657.54516.737376.420610@swsmde.ds.mpi-sws.mpg.de>
To: www-validator@w3.org
It's poor style for local variables to shadow existing variables -- that
is, to reuse the same variable name in a smaller scope.  This patch
corrects a few such problems in checklink.

                    -Mike


Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.116
diff -u -u -b -r4.116 checklink
--- checklink	22 Sep 2008 19:33:31 -0000	4.116
+++ checklink	30 Sep 2008 07:16:38 -0000
@@ -1823,18 +1917,18 @@
 # Determine if a request is redirected
 sub is_redirected ($%)
 {
-  my ($uri, %redirects) = @_;
-  return(defined($redirects{$uri}));
+  my ($uri, %my_redirects) = @_;
+  return(defined($my_redirects{$uri}));
 }
 
 # Get a list of redirects for a URI
 sub get_redirects ($%)
 {
-  my ($uri, %redirects) = @_;
+  my ($uri, %my_redirects) = @_;
   my @history = ($uri);
   my %seen = ($uri => 1); # for tracking redirect loops
   my $loop = 0;
-  while ($redirects{$uri}) {
+  while ($my_redirects{$uri}) {
     $uri = $redirects{$uri};
     push(@history, $uri);
     if ($seen{$uri}) {
Received on Tuesday, 30 September 2008 07:28:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:32 GMT