Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Error Handling

Status
Not open for further replies.

Extension

Programmer
Nov 3, 2004
311
CA
Hi,

I'm currently Carp for error handling on my development server. I like the fataltobrowser subroutine for debugging.

Now I'm looking for a routine/sub-routine that would handle errors in production. I simply want to display a HTML message if there's an error ("out of service" type of message). I don't want to show any details about the error(s).

Any info would be appreciated.

Thanks
 
Instead of stuff like this:

Code:
open (FH, 'foo') or die "$!";

You do something like this:

Code:
open (FH, 'foo') or error();

sub error {
   print "whatever you want";
   exit(0);
}

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
That's what I'm doing for files but I'm looking for something that will cover syntax errors, missing modules/subroutines.

Thanks again
 
Look at:
You can use CGI::Carp and just set a custom page to handle it, where you could write the error to a log file and don't show it on the page, or choose whether to show it based on hostname (if you have a dev.mysite.com sort of subdomain syntax) or other factors.

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top