> Rob, thanks for pointing me in the right direction.  Your advise
> helped me find a solution that works for my situation.

You're welcome!

> I'm working on an API that sits between an Oracle DB and bunch of web
> application programmers.  Unfortunately, the programmers run their
> apps under a variety of perl-handlers (Apache::Registry,
> Apache::RegistryNG,
> Apache::RegistryFilter, etc).  None of the programmers follow any
> sort of standard method for handling exceptions, so I can't assume
> that 'return OK;' will ever be called (in fact I'm pretty sure, it
> will never be called).  What I've been trying to do is kind of 'take
> over' the request, whenever a programmer fails to connect to the DB and
> redirect the browser to a handler that can put up a custom 503 page
> for each application.

OK 1: none of the example environments you listed that your programmers are
in include straight mod_perl... in fact they are all CGI emulation layers of
varying degrees of protection/dirtiness.  Do I read you correctly?

> I finally settled on putting the following in conf file for the web
> sites:
>
> ErrorDocument 503 "<HTML><HEAD><META http-equiv="refresh"
> content="0;URL=/DBConnectError.cgi"></HEAD></HTML>
>
> <Files DBConnectError.cgi>
>        SetHandler perl-script
>        PerlHandler Tec::Api::DBConnectError
> </Files>

Well, this is all fine except for one important detail:  HOW, and I mean, if
you can't answer this you haven't solved the problem, but HOW do you know
that your programmers' programs are going to fire a 503 if there is a
database error????

> It seems to work for just about every perl handler the programmers are
> using, as long as they doesn't use Carp::fatalsToBrowser, which
> raises a whole new set of problems.

(you could always chmod 000 `find /usr/lib/perl5 -name fatalsToBrowser.pm`
:-)

> If you see any issues with my solution, please chime in.

Well as far as I can see, you're trying to ensure that the programmers are
correctly connected to the database.  It *looks* like /DBConnectError.cgi is
a reconnect setup.  Presumably, this has an API that your programmers are
using to get DB handles (DBI?).

But the only way for this setup to work is if the PROGRAMMERS know that if a
database call fails, to throw 503:

my $dbh = DBI->connect(Local::get_connect_args) or print "Status: 503\n\n",
exit;

Otherwise, all of this fancy footwork you're doing will be pointless.

Is there something I'm missing?

Reply via email to