SVN: toys/rsget.pl/RSGet/Get.pm

sparky sparky at pld-linux.org
Wed Jul 28 15:31:39 CEST 2010


Author: sparky
Date: Wed Jul 28 15:31:39 2010
New Revision: 11720

Modified:
   toys/rsget.pl/RSGet/Get.pm
Log:
- added download_fail callback


Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm	(original)
+++ toys/rsget.pl/RSGet/Get.pm	Wed Jul 28 15:31:39 2010
@@ -11,6 +11,7 @@
 use RSGet::Captcha;
 use RSGet::Form;
 use RSGet::Wait;
+use RSGet::Hook;
 use URI;
 set_rev qq$Id$;
 
@@ -25,6 +26,10 @@
 		desc => "Directory where temporary files (cookies and dumps) are stored.",
 		type => "PATH",
 	},
+	download_fail => {
+		desc => "Command executed if download fails.",
+		type => "COMMAND",
+	},
 );
 
 BEGIN {
@@ -319,6 +324,15 @@
 	$self->print( $msg ) || $self->log( $msg );
 	RSGet::FileList::save( $self->{_uri}, options => { error => $msg } );
 	RSGet::Dispatch::finished( $self );
+	if ( my $call = setting( "download_fail" ) ) {
+		RSGet::Hook::call( $call,
+			uri => $self->{_uri},
+			error => $msg,
+			getter => $self->{_pkg},
+			interface => $self->{_outif},
+			command => $self->{_cmd},
+		);
+	}
 }
 
 sub problem


More information about the pld-cvs-commit mailing list