Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8735159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:59:18+00:00 2026-06-13T09:59:18+00:00

I am converting some cgi scripts to mod_perl. Under cgi, I used a sig

  • 0

I am converting some cgi scripts to mod_perl. Under cgi, I used a sig DIE to capture stack traces whenever there was an uncaptured exception, and logged them. This worked great: whenever something died in the script, I’d get a nice stack trace in my application logs. Code is:

BEGIN {
  $SIG{__DIE__} = \&sigDie;
}

sub sigDie {
  return 1 if $^S; # we are in an eval block

  my ($error) = @_;
  cluck("Caught fatal error: $error"); # put a stack trace in the logs via warn
  local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
  FATAL @_; # call log4perl's fatal

  return 1;
}

Under Apache2::Registry, however, my code is no longer called, it simply stops logging when it dies. I assumed this was because my code is being eval’ed by mod_perl, but I took the eval check off my routine above and I’m still not getting called.

Is there any way I can get what I want under mod_perl? I have found these automatic logging of stack traces immensely useful and would miss them if I have to forgo them. So far I have come up empty on how to get it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:59:19+00:00Added an answer on June 13, 2026 at 9:59 am

    I don’t know the answer, but can think of a few possibilities and ways to check.

    • Something is wrong with log4perl.

    Does a call to FATAL still work outside of a __DIE__ handler?

    • Errors are not being logged at all.

    Remove the die handler, do exceptions get logged?

    • Something is replacing your $SIG{__DIE__} handler.

    Since you’re setting it up at BEGIN time, it’s possible something either in Apache2::Registry or another program is replacing it. I’d find out by verifying what is in $SIG{__DIE__} just before throwing an error. Perhaps dumping it out with Data::Dump::Streamer, which can handle code refs, you might be able to figure out what’s setting it.

    A safer, and more polite, way to register a die handler is…

    local $SIG{__DIE__} = ...;
    
    ...the rest of your program...
    

    This will re-register your handler on each request AND not blow over a global handler outside of its scope.

    Hope that helps to figure out what’s going on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just converting some shell scripts into batch files and there is one thing I
I have been tasked with converting some scripts referencing an Informix database to be
I have some objective-c code I'm converting from iPhone to iPad. CFGregorianDate is used
Im converting some python scripts that uses regex to exract contents from a html
I am converting some code from C to C++ in MS dev studio under
I'm converting some legacy code to Delphi 2010. There are a fair number of
I am converting some ASP.Net controls to Silverlight. Is there something similar to ASP.Net's
I'm converting some shell scripts to perl. All the database access is done using
I've spent some time converting my SVN repository to Mercurial. I've setup Mercurial under
I'm having a bit of difficulties converting some regex from being used in preg_match_all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.