[Debian-l10n-commits] r1028 - /dl10n/trunk/lib/Debian/L10n/Spider.pm

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Wed May 28 20:01:42 UTC 2008


Author: nekral-guest
Date: Wed May 28 20:01:42 2008
New Revision: 1028

URL: http://svn.debian.org/wsvn/?sc=1&rev=1028
Log:
Add comprehensive warnings when a subject cannot be parsed, or when the html
page of the mail cannot be retrieved.
Retry three times if a page cannot be downloaded.

Modified:
    dl10n/trunk/lib/Debian/L10n/Spider.pm

Modified: dl10n/trunk/lib/Debian/L10n/Spider.pm
URL: http://svn.debian.org/wsvn/dl10n/trunk/lib/Debian/L10n/Spider.pm?rev=1028&op=diff
==============================================================================
--- dl10n/trunk/lib/Debian/L10n/Spider.pm (original)
+++ dl10n/trunk/lib/Debian/L10n/Spider.pm Wed May 28 20:01:42 2008
@@ -129,7 +129,11 @@
 		$names =~ m/^([^{]*){([^}]*)}(.*)$/;
 		my $begin = $1 || "";
 		my $end   = $3 || "";
-		@names = map { "$begin$_$end" } split(/,/, $2);
+		if (defined $2) {
+			@names = map { "$begin$_$end" } split(/,/, $2);
+		} else {
+			warn "Could not parse Subject: '$subject'\n";
+		}
 	} else {
 		@names = ($names);
 	}
@@ -268,7 +272,18 @@
 		chomp @html;
 	} else {
 		my $answer = $Web_agent -> request(HTTP::Request -> new (GET => "http://lists.debian.org/$file"));
-		return undef unless $answer -> is_success;
+		# The download of the web page may fail.
+		# Retry three times.
+		unless ($answer -> is_success) {
+			$answer = $Web_agent -> request(HTTP::Request -> new (GET => "http://lists.debian.org/$file"));
+		}
+		unless ($answer -> is_success) {
+			$answer = $Web_agent -> request(HTTP::Request -> new (GET => "http://lists.debian.org/$file"));
+		}
+		unless ($answer -> is_success) {
+			warn "Failed to retrieve 'http://lists.debian.org/$file'\n";
+			return undef;
+		}
 		my $html = $answer -> content;
 		@html = split(/\n/, $html);
 	}




More information about the Debian-l10n-commits mailing list