On Tue, 20 Aug 2002 08:35:40 -0400 [EMAIL PROTECTED] wrote: > Peter, > > You could put your DBI->connect within an eval block. > > Tim Helck > > -----Original Message----- > From: David N Murray [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 20, 2002 7:57 AM > To: Levine, Peter W > Cc: '[EMAIL PROTECTED]' > Subject: Re: suprressing "login incorrect" error > > > Any luck with RaiseError=>0,PrintError=>0? That seems to work for me. > > On Aug 19, Levine, Peter W scribed: > > > Hi, > > > > I'm using DBI in a cgi-bin script. I can't find a way to suppress the > error > > message "DB-Library: Login incorrect" if DBI->connect fails. This is > an > > issue because the raw output causes a web server 500 error. > > > > I've tried setting PrintError, WarnError to false TO no avail. I've > also > > tried intervention with a signal handler like this: > > > > local $SIG{__DIE__}=sub { errhandler $_[0] }; > > local $SIG{__WARN_}=sub { errhandler $_[0] }; > > > > where errhandler is defined as: > > sub errhandler { > > my $err=shift; > > if($err eq "") > > { > > $err=$webErr; # this is a global variable I'm using > > } > > print"Content-type: text/plain\r\n\r\n"; > > print "<HTML><BODY>ERROR: $err</BODY></HTML>\n"; > > } > > > > But the signal handler doesn't get called. How do you suppress this > message?
Either method given above should work and both are mentioned in the fine manual. Run 'perldoc DBI' to read it. -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age.
