well... it must catch it. BEGIN blocks happen at the compile time and at the beginning...
for example, I can catch this compile time error: #!/usr/bin/perl -w use strict; BEGIN { $| = 1; $SIG{__DIE__} = sub my $msg = shift; print "ERROR: $msg"; exit; }; } use dbdbdb; but if I add the signal code outside BEGIN, I can not catch it... if you didnt properly defined EventLogger() sub, that can be the problem... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Farrington, Ryan Sent: Friday, July 18, 2003 5:26 PM To: [EMAIL PROTECTED] Subject: RE: REWRITE RE: Error trapping Grrrrrrr still didn't catch the error -----Original Message----- From: Burak Gürsoy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2003 1:06 PM To: [EMAIL PROTECTED] Subject: RE: REWRITE RE: Error trapping ok, try this one: #!/usr/bin/perl -w use strict; BEGIN $| = 1; $SIG{__DIE__} = sub my $msg = shift; EventLogger("PERL Service", "error", "666", "$msg\n\n"); exit; }; } # add your code here... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Farrington, Ryan Sent: Thursday, July 17, 2003 4:18 PM To: '[EMAIL PROTECTED]' Subject: REWRITE RE: Error trapping Ok so now here is the stumper for me... I used [code] Local $SIG{__DIE__} = sub my $msg = shift; EventLogger("PERL Service", "error", "666", "$msg\n\n"); exit; }; [/code] And it died again today but no event written =( if it dies in a module will this catch it? -----Original Message----- From: Burak Gursoy [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:52 PM To: [EMAIL PROTECTED] Subject: RE: Error trapping it is $SIG{__DIE__} actually... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Carl Jolley Sent: Tuesday, July 15, 2003 7:39 PM To: FARRINGTON, RYAN Cc: [EMAIL PROTECTED] Subject: Re: Error trapping On Mon, 14 Jul 2003, FARRINGTON, RYAN wrote: > Ok I have a perl script that has been compiled as an executable and is > running on a 2K server as a service. Now the problem is that it is > die'ing without generating an error. Is there anyway to trap the die > and then have it output it to a function before actually die'ing? > Have you tried to define a $SIG{DIE} subroutine? **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs