Author: sparky
Date: Tue Feb 15 00:38:23 2011
New Revision: 12150

Modified:
   toys/rsget.pl/RSGet/Get.pm
   toys/rsget.pl/RSGet/Wait.pm
Log:
- allow plugins to die without killing whole rsget.pl


Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm  (original)
+++ toys/rsget.pl/RSGet/Get.pm  Tue Feb 15 00:38:23 2011
@@ -102,7 +102,7 @@
                }
        }
 
-       $self->start();
+       $self->call( \&start );
        return $self;
 }
 
@@ -198,6 +198,21 @@
        return $self->stage0();
 }
 
+sub call
+{
+       my $self = shift;
+       my $func = shift;
+
+       local $SIG{__DIE__};
+       delete $SIG{__DIE__};
+       eval {
+               return &$func( $self, @_ );
+       };
+       if ( $@ ) {
+               $self->problem( "function call problem: $@" );
+       }
+}
+
 sub cookie
 {
        my $self = shift;
@@ -257,7 +272,7 @@
                return;
        }
        $_ = $self->{body};
-       &$func( $self );
+       $self->call( $func );
 }
 
 sub click_download
@@ -325,8 +340,7 @@
        if ( $self->{is_html} ) {
                $self->print( "is HTML" );
                $_ = $self->{body};
-               my $func = $self->{stage_is_html};
-               return &$func( $self );
+               return $self->call( $self->{stage_is_html} );
        }
 
        RSGet::Dispatch::mark_used( $self );

Modified: toys/rsget.pl/RSGet/Wait.pm
==============================================================================
--- toys/rsget.pl/RSGet/Wait.pm (original)
+++ toys/rsget.pl/RSGet/Wait.pm Tue Feb 15 00:38:23 2011
@@ -59,8 +59,7 @@
 
        $self->linedata();
        $self->linecolor();
-       my $func = $self->{wait_next};
-       &$func( $self );
+       $self->call( $self->{wait_next} );
 }
 
 sub wait_update
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to