perl/modules/W3C/LogValidator/lib/W3C/LogValidator HTMLValidator.pm,1.27,1.28 CSSValidator.pm,1.21,1.22

Update of /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator
In directory hutz:/tmp/cvs-serv20234

Modified Files:
	HTMLValidator.pm CSSValidator.pm 
Log Message:
filtering out non-HTTP-200 entries for CSS and Markup validation

Index: HTMLValidator.pm
===================================================================
RCS file: /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator/HTMLValidator.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- HTMLValidator.pm	7 Sep 2007 06:15:27 -0000	1.27
+++ HTMLValidator.pm	14 Nov 2008 23:15:10 -0000	1.28
@@ -8,6 +8,7 @@
 
 package W3C::LogValidator::HTMLValidator;
 use strict;
+use DB_File; 
 
 
 require Exporter;
@@ -155,6 +156,15 @@
 	}
 	else { print "nothing to exclude\n" if ($verbose >2);}
 	my $uri;
+	my %HTTPcodes;
+	if (defined ($config{tmpfile_HTTP_codes}))
+	{
+		my $tmp_file_HTTP_codes = $config{tmpfile_HTTP_codes};
+		tie (%HTTPcodes, 'DB_File', "$tmp_file_HTTP_codes", O_RDONLY) || 
+		    die ("Cannot create or open $tmp_file_HTTP_codes");
+	}
+
+
         while ($uri = shift)
         {
                 my $uri_ext = "";
@@ -177,17 +187,27 @@
 		if ($match)
 		{
             	  foreach my $area (@excluded_areas)
-            	  {
+                {
                     if ($uri =~ /$area/)
                     {
-			my $slasharea = $area;
+                        my $slasharea = $area;
                         $slasharea =~ s/\\\//\//g;
                         $slasharea =~ s/\\././g;
                         print "Ignoring $uri matching $slasharea \n" if ($verbose > 2) ;
                         $match = 0;
                     }
+                  }
+                }
 
-		  }
+                if (defined $HTTPcodes{$uri}) 
+                { 
+                  if (($HTTPcodes{$uri} ne "200")  and ($HTTPcodes{$uri} =~ /\d+/))
+                  {
+                    $match = 0;
+                    if ($verbose > 1) { 
+                      print "$uri returned code $HTTPcodes{$uri}, ignoring \n"; 
+                    }
+                  }
                 }
             push @trimmed_uris,$uri if ($match);            
         }
@@ -209,7 +229,6 @@
 	# Opening the file with the hits and URIs data
 	if (defined ($config{tmpfile}))
 	{
-		use DB_File; 
 		my $tmp_file = $config{tmpfile};
 		tie (%hits, 'DB_File', "$tmp_file", O_RDONLY) || 
 		    die ("Cannot create or open $tmp_file");

Index: CSSValidator.pm
===================================================================
RCS file: /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator/CSSValidator.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- CSSValidator.pm	5 May 2008 06:41:56 -0000	1.21
+++ CSSValidator.pm	14 Nov 2008 23:15:11 -0000	1.22
@@ -9,6 +9,7 @@
 package W3C::LogValidator::CSSValidator;
 use strict;
 use warnings;
+use DB_File; 
 
 
 
@@ -143,6 +144,14 @@
         }
         else { print "nothing to exclude\n" if ($verbose >2);}
         my $uri;
+      	my %HTTPcodes;
+      	if (defined ($config{tmpfile_HTTP_codes}))
+      	{
+      		my $tmp_file_HTTP_codes = $config{tmpfile_HTTP_codes};
+      		tie (%HTTPcodes, 'DB_File', "$tmp_file_HTTP_codes", O_RDONLY) || 
+      		    die ("Cannot create or open $tmp_file_HTTP_codes");
+      	}
+
         while ($uri = shift)
         {
                 my $uri_ext = "";
@@ -176,6 +185,16 @@
                   }
                 }
 
+                if (defined $HTTPcodes{$uri}) 
+                { 
+                  if (($HTTPcodes{$uri} ne "200")  and ($HTTPcodes{$uri} =~ /\d+/))
+                  {
+                    $match = 0;
+                		if ($verbose > 1) { 
+                		    print "$uri returned code $HTTPcodes{$uri}, ignoring \n"; 
+                		}
+                  }
+                }
                 push @trimmed_uris,$uri if ($match);
         }
         return @trimmed_uris;
@@ -209,7 +228,6 @@
 	my %hits;
 	if (defined ($config{tmpfile}))
 	{
-		use DB_File; 
 		my $tmp_file = $config{tmpfile};
 		tie (%hits, 'DB_File', "$tmp_file", O_RDONLY) || 
 		    die ("Cannot create or open $tmp_file");

Received on Friday, 14 November 2008 23:15:21 UTC