checklink: improve verbose output

This patch adds output in a few key places, when checklink is run in
verbose mode.  This aids in debugging the program.

The patch also corrects one spelling error in a comment.

                    -Michael Ernst


diff -u -b -r --exclude=CVS --exclude=.hg --exclude=.svn /DS/home-0/mernst/bin/src/perl/W3C-LinkChecker/perl/modules/W3C/LinkChecker/bin/checklink-orig /DS/home-0/mernst/bin/src/perl/W3C-LinkChecker/perl/modules/W3C/LinkChecker/bin/checklink-patched-verbose-output
--- /DS/home-0/mernst/bin/src/perl/W3C-LinkChecker/perl/modules/W3C/LinkChecker/bin/checklink-orig	2008-06-29 20:12:02.185277047 +0200
+++ /DS/home-0/mernst/bin/src/perl/W3C-LinkChecker/perl/modules/W3C/LinkChecker/bin/checklink-patched-verbose-output	2008-06-29 20:39:50.277532530 +0200
@@ -134,7 +134,7 @@
 }
 
 #
-# Checks whether we're allowed to retrieve the document based on it's IP
+# Checks whether we're allowed to retrieve the document based on its IP
 # address.  Takes an URI object and returns a HTTP::Response containing the
 # appropriate status and error message if the IP was disallowed, 0
 # otherwise.  URIs without hostname or IP address are always allowed,
@@ -910,6 +910,8 @@
   # Check links
   #############
 
+  &hprintf("Recording all the links found: %d\n", scalar (keys %{$p->{Links}}))
+    if ($Opts{Verbose});
   my %links;
   # Record all the links found
   while (my ($link, $lines) = each(%{$p->{Links}})) {
@@ -943,6 +945,8 @@
   }
 
   # Build the list of broken URI's
+  &hprintf("Checking %d links to build list of broken URI's\n", scalar (keys %links))
+    if ($Opts{Verbose});
   my %broken;
   while (my ($u, $ulinks) = each(%links)) {
 
@@ -1031,7 +1035,7 @@
       if ($Opts{HTML}) {
         if (!$Opts{Command_Line}) {
           if ($doc_count == $Opts{Max_Documents}) {
-            print("<hr />\n<p><strong>Maximum number of documents reached!</strong></p>\n");
+            print("<hr />\n<p><strong>Maximum number of documents ($Opts{Max_Documents}) reached!</strong></p>\n");
           }
           if ($doc_count >= $Opts{Max_Documents}) {
             $doc_count++;
@@ -1336,6 +1340,9 @@
 {
   my ($uri, $base_uri, $response, $links, $rec_needs_links) = @_;
 
+  print("parse_document($uri, $base_uri, ..., $links, $rec_needs_links)\n")
+    if $Opts{Verbose};
+
   my $p;
 
   if (defined($results{$uri}{parsing})) {

Diff finished.  Sun Jun 29 20:44:24 2008

Received on Monday, 30 June 2008 04:13:19 UTC