You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ray Zimmerman <rz...@cornell.edu> on 2003/09/08 22:10:03 UTC

'die' in a CleanupHandler

Just curious ... what happens if I call 'die' in a mod_perl handler 
(especially a CleanupHandler)?  Does it actually kill the apache 
child or does something catch the exception before that happens?

-- 
  Ray Zimmerman  / e-mail: rz10@cornell.edu / 428-B Phillips Hall
   Sr Research  /   phone: (607) 255-9645  /  Cornell University
    Associate  /      FAX: (815) 377-3932 /   Ithaca, NY  14853

Re: 'die' in a CleanupHandler

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2003-09-08 at 21:49, Ray Zimmerman wrote:
> I was just considering how to handle it when a serious error occurs 
> during a CleanupHandler

If you want the handler to continue, you have to catch the error
yourself using normal methods.

> and was wondering what the difference was 
> between 'warn' and 'die' in that context.

The same as any other context: warn sends a message to STDERR and
continues, while die throws an exception.  There is a lengthy section on
error handling in the mod_perl guide.

- Perrin


Re: 'die' in a CleanupHandler

Posted by Ray Zimmerman <rz...@cornell.edu>.
At 6:19 PM -0400 9/8/03, Perrin Harkins wrote:
>On Mon, 2003-09-08 at 16:10, Ray Zimmerman wrote:
>>  Just curious ... what happens if I call 'die' in a mod_perl handler
>>  (especially a CleanupHandler)?  Does it actually kill the apache
>>  child or does something catch the exception before that happens?
>
>The latter.  Your 'die' is caught by mod_perl.  Is there something
>you're trying to do?

I was just considering how to handle it when a serious error occurs 
during a CleanupHandler and was wondering what the difference was 
between 'warn' and 'die' in that context.

-- 
  Ray Zimmerman  / e-mail: rz10@cornell.edu / 428-B Phillips Hall
   Sr Research  /   phone: (607) 255-9645  /  Cornell University
    Associate  /      FAX: (815) 377-3932 /   Ithaca, NY  14853

Re: 'die' in a CleanupHandler

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2003-09-08 at 16:10, Ray Zimmerman wrote:
> Just curious ... what happens if I call 'die' in a mod_perl handler 
> (especially a CleanupHandler)?  Does it actually kill the apache 
> child or does something catch the exception before that happens?

The latter.  Your 'die' is caught by mod_perl.  Is there something
you're trying to do?

- Perrin