perl/modules/W3C/LinkChecker/bin checklink,4.38,4.39

Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv16226

Modified Files:
	checklink 
Log Message:
Don't let earlier URIs on the command line implicitly limit recursion scope
of subsequent ones (Debian #277969).


Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.38
retrieving revision 4.39
diff -u -d -r4.38 -r4.39
--- checklink	15 Oct 2006 16:28:05 -0000	4.38
+++ checklink	15 Oct 2006 16:33:32 -0000	4.39
@@ -289,7 +289,8 @@
 
   &ask_password() if ($Opts{User} && !$Opts{Password});
 
-  my $first = 1;
+  my $is_first = 1;
+  my @bases = @{$Opts{Base_Locations}};
   foreach my $uri (@ARGV) {
     if (!$Opts{Summary_Only}) {
       printf("%s %s\n", $PACKAGE, $REVISION) unless $Opts{HTML};
@@ -297,12 +298,15 @@
       $Opts{Verbose} = 0;
       $Opts{Progress} = 0;
     }
+    # Reset base locations so that previous URI's given on the command line
+    # won't affect the recursion scope for this URI
+    @{$Opts{Base_Locations}} = @bases;
     # Transform the parameter into a URI
     $uri = &urize($uri);
-    &check_uri($uri, $first, $Opts{Depth});
-    $first &&= 0;
+    &check_uri($uri, $is_first, $Opts{Depth}, undef, 1);
+    $is_first &&= 0;
   }
-  undef $first;
+  undef $is_first;
 
   if ($Opts{HTML}) {
     &html_footer();
@@ -637,10 +641,11 @@
 # Check for broken links in a resource #
 ########################################
 
-sub check_uri ($$$;$)
+sub check_uri ($$$;$$)
 {
 
-  my ($uri, $first, $depth, $cookie) = @_;
+  my ($uri, $is_first, $depth, $cookie, $is_start) = @_;
+  $is_start ||= $is_first;
 
   my $start = &get_timestamp() unless $Opts{Quiet};
 
@@ -650,7 +655,7 @@
   # Can we check the resource? If not, we exit here...
   return -1 if defined($response->{Stop});
 
-  if ($first) {
+  if ($is_start) { # Starting point of a new check, eg. from the command line
     # Use the first URI as the recursion base unless specified otherwise.
     push(@{$Opts{Base_Locations}}, $response->{absolute_uri}->canonical())
       unless @{$Opts{Base_Locations}};
@@ -666,7 +671,7 @@
   $doc_count++;
 
   if ($Opts{HTML}) {
-    &html_header($uri, 0, $cookie) if $first;
+    &html_header($uri, 0, $cookie) if $is_first;
     print('<h2>');
   }
 
@@ -674,7 +679,7 @@
 
   my $result_anchor = 'results'.$doc_count;
 
-  if ($first && !$Opts{HTML} && !$Opts{Summary_Only}) {
+  if ($is_first && !$Opts{HTML} && !$Opts{Summary_Only}) {
     my $s = $Opts{Sleep_Time} == 1 ? '' : 's';
     my $acclang = $Opts{Accept_Language} || '(not sent)';
     printf(<<'EOF', $Accept, $acclang, $Opts{Sleep_Time}, $s);

Received on Sunday, 15 October 2006 16:33:43 UTC