perl/modules/W3C/LinkChecker/bin checklink,3.47,3.48

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

Modified Files:
	checklink 
Log Message:
Apply parameters from cookie only when loading the "front" page.
Also, only load the cookie we set (not all possibly sent to us), when
deciding how to output the cookie options on the front page.
This should make the effect of the cookie more predictable.


Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 3.47
retrieving revision 3.48
diff -u -d -r3.47 -r3.48
--- checklink	1 Jun 2004 19:18:33 -0000	3.47
+++ checklink	1 Jun 2004 21:49:59 -0000	3.48
@@ -285,21 +285,25 @@
   $Opts{_Self_URI} = $query->url(-relative => 1);
 
   # Backwards compatibility
-  if ($query->param('hide_dir_redirects')) {
-    $query->param('hide_redirects', 'on');
-    $query->param('hide_type', 'dir');
-    $query->delete('hide_dir_redirects');
-  }
-  if (my $uri = $query->param('url')) {
+  my $uri = undef;
+  if ($uri = $query->param('url')) {
     $query->param('uri', $uri) unless $query->param('uri');
     $query->delete('url');
   }
+  $uri = $query->param('uri');
 
-  # Override undefined values from the cookie, if we got one.
-  if (my %cookie = $query->cookie($PROGRAM)) {
-    while (my ($key, $value) = each %cookie) {
-      $query->param($key, $value) unless defined($query->param($key));
-    }
+  if (! $uri) {
+    &html_header('', 1); # Set cookie only from results page.
+    &print_form($query);
+    &html_footer();
+    exit;
+  }
+
+  # Backwards compatibility
+  if ($query->param('hide_dir_redirects')) {
+    $query->param('hide_redirects', 'on');
+    $query->param('hide_type', 'dir');
+    $query->delete('hide_dir_redirects');
   }
 
   $Opts{Summary_Only} = 1 if $query->param('summary');
@@ -317,7 +321,7 @@
 
   $Opts{Depth} = -1 if ($query->param('recursive') && $Opts{Depth} == 0);
   if (my $depth = $query->param('depth')) {
-    # Ignore invalid depth silently for now.
+    # @@@ Ignore invalid depth silently for now.
     $Opts{Depth} = $1 if ($depth =~ /(-?\d+)/);
   }
 
@@ -345,15 +349,6 @@
     $cookie = $query->cookie(%cookie);
   }
 
-  my $uri = $query->param('uri');
-
-  if (! $uri) {
-    &html_header('', 1); # Set cookie only from results page.
-    &print_form($query);
-    &html_footer();
-    exit;
-  }
-
   undef $query; # Not needed any more.
 
   # All Apache configurations don't set HTTP_AUTHORIZATION for CGI scripts.
@@ -2066,6 +2061,15 @@
 {
   my ($q) = @_;
 
+  # Override undefined values from the cookie, if we got one.
+  my $got_cookie = 0;
+  if (my %cookie = $q->cookie($PROGRAM)) {
+    $got_cookie = 1;
+    while (my ($key, $value) = each %cookie) {
+      $q->param($key, $value) unless defined($q->param($key));
+    }
+  }
+
   my $chk = ' checked="checked"';
   $q->param('hide_type', 'all') unless $q->param('hide_type');
 
@@ -2078,7 +2082,7 @@
   my $dep = &encode($q->param('depth')              || '');
 
   my $cookie_options = '';
-  if ($q->cookie()) {
+  if ($got_cookie) {
     $cookie_options = "
     <label for=\"cookie1\"><input type=\"radio\" id=\"cookie1\" name=\"cookie\" value=\"nochanges\" checked=\"checked\"> Don't modify saved options</label>
     <label for=\"cookie2\"><input type=\"radio\" id=\"cookie2\" name=\"cookie\" value=\"set\"> Save these options</label>

Received on Tuesday, 1 June 2004 17:50:02 UTC