CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
help with program terminating

 



jamesfinnegan
Novice

Oct 1, 2002, 11:09 AM

Post #1 of 2 (885 views)
help with program terminating Can't Post

Is there a way in perl to send a program to a subroutine whenever the perl script ends in some kind of error? I'd like the subroutine to log to file the line number that caused the program abend. I know that in programming rexx I put this at the top of the program

signal on halt name subroutinex
signal on error name subroutiney
signal on syntax name subroutinez

Does anyone know of anything similar? Thanks for the help.

Jim


Paul
Enthusiast

Oct 1, 2002, 11:32 AM

Post #2 of 2 (883 views)
Re: [jamesfinnegan] help with program terminating [In reply to] Can't Post


Code
local $SIG{__DIE__} = \&barf; # Goes somewhere near the top 

sub barf {
my $error = shift;
my @caller = caller;
# Your stuff here
}



(This post was edited by RedRum on Oct 1, 2002, 11:33 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives