Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Re: Detecting a failed DBI connection

by mt2k (Hermit)
on Dec 09, 2002 at 03:32 UTC ( #218443=note: print w/replies, xml ) Need Help??

in reply to Re: Detecting a failed DBI connection
in thread Detecting a failed DBI connection

I'm just wondering as to whether your way of printing out errors to the browser is efficient. For starters, this is really just reinventing the fatalsToBrowser method provided by the CGI::Carp module. I could understand this if maybe you didn't want all errors to be outputted to the user's browser. But even at this point, you'd have to make sure that HTTP headers have already been sent to the browser, otherwise your code would just damage the output. If you're set on using this, maybe a subroutine call would be more appropriate, so that you can later change the error handling behaviour. Besides, then you won't have ugly exit() calls hanging around everywhere :)

mt2k -> must try 2 know

  • Comment on Re: Re: Detecting a failed DBI connection

Replies are listed 'Best First'.
Re: Re: Re: Detecting a failed DBI connection
by pfaut (Priest) on Dec 09, 2002 at 03:46 UTC

    I wouldn't write code this way but the user's example had not used the CGI module and had already put out the http header. The original poster wanted to know how to find out what went wrong so I plugged an [unfortunately broken] example of how to find out into his code. I guess I could have gone on to give a couple of pointers on better ways to structure his web apps and rewritten his entire snippet for him but I thought he's already having problems with DBI, why confuse him with talk about CGI? Hopefully, he'll get there when he's ready for it.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://218443]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2023-12-10 16:33 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (40 votes). Check out past polls.