You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by David McCabe <dm...@videotron.net> on 2000/10/19 20:19:46 UTC

Exiting a module

OK, I can't find the answer to this in the docs, so I will try here.

Relevant info:

Solaris 8
(the following were all built with gcc 2.95.2 from sunfreeware.com)
perl 5.6.0
mod_perl 1.24
Apache 1.3.12

In my Module, I have an error-displaying sub, as I trap all the errors myself. My
current code looks something like this:
(this is in a sub called from the handler() sub)

if (! ($sth = $dbh->prepare_cached($sql)))
{
     my_error_prnt(...);
     return;
}

This works fine. The my_error_prnt() sub is using the CGI module to output a nice
HTML page, with some error messages passed to it. I then return to this sub, then
return to the handler(), which then "falls out" through my code.

However, if I try to put an Apache::exit() at the end of my_error_prnt, I get a
server error, and the error log only says "error at line 202" line 202 has the
Apache::exit call. I want to do this so I can code all my error traps like this:

my_error_prnt() unless ($sth = $dbh->prepare_cached($sql));

And get rid of all the loops that need to exist just for a "return;" statement

I have also tried with Apache::exit(Apache::Constants::OK), but no difference.

Any ideas on how I can do this??



David McCabe  Unix System Administrator
Le Groupe Videotron dmccabe@videotron.net   (514) 380 4433

"Serving children is our specialty. Approximate time to 
prepare: 45 minutes."
                          Sign in Jack Astors resto/pub


Re: Exiting a module

Posted by Bill Moseley <mo...@hank.org>.
At 02:19 PM 10/19/00 -0400, David McCabe wrote:
>However, if I try to put an Apache::exit() at the end of my_error_prnt, I
get a
>server error, and the error log only says "error at line 202" line 202 has
the
>Apache::exit call.

This was fixed in 1.24_01, I believe.



Bill Moseley
mailto:moseley@hank.org