[Net-z3950] [PATCH] Net::Z3950 allow die handlers

Dave Mitchell davem at fdgroup.com
Wed May 15 13:20:00 CEST 2002


Mike, here's a trivial patch to Net::Z3950 0.28 that allows you to specify
your own Event die handler

To use:

    use Net::Z3950;
    $mgr = new Net::Z3950::Manager(
		    die_handler	=> sub { warn $_[1]; exit 1 },
		);
		    
    $conn = $mgr->connect(
		    ....


--- Z3950/Manager.pm-	Wed May 15 11:44:29 2002
+++ Z3950/Manager.pm	Wed May 15 11:48:13 2002
@@ -213,7 +213,10 @@
     #	is?  There's no single main()-like entry-point to this
     #	library, so we may as well set Event's die()-handler just
     #	before we hand over control.
-    $Event::DIED = \&Event::verbose_exception_handler;
+
+    my $handler = $this->option('die_handler');
+    $Event::DIED = defined $handler ? $handler
+    				: \&Event::verbose_exception_handler;
 
     my $conn = Event::loop();
     return $conn;

-- 
You live and learn (although usually you just live).




More information about the Net-z3950 mailing list