Ananda has asked for the wisdom of the Perl Monks concerning the following question:
Hello All,
Greetings!!
Here is a piece of code, using which,I am trying to capture the Error code in a log file on the "die" event. I need to avoid printing the error message on the Console.I havent been successful so far.
Kindly Advice.
Anandamy $db = DBI->connect("dbi:Oracle:host=shost;sid=$sid;port=$port", $ui +d, $pwd) or {capture_error()}; #===================================================================== # simple debugging routine #===================================================================== sub debug { if ($debug_output) { # print STDERR @_; # Just return if it fails to open debug file open(OUT, ">>$debug_output") || return; print OUT @_, "\n"; close(OUT); } } #===================================================================== # capture error routine #===================================================================== sub capture_error { debug("Error while connecting to database!!!\nIncorrect Connection + information\n"); exit(0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing Error message in a log file.
by graff (Chancellor) on Jan 03, 2003 at 04:41 UTC | |
by pfaut (Priest) on Jan 03, 2003 at 13:25 UTC | |
|
Re: Capturing Error message in a log file.
by gjb (Vicar) on Jan 03, 2003 at 04:56 UTC | |
|
Re: Capturing Error message in a log file.
by vek (Prior) on Jan 03, 2003 at 14:37 UTC | |
|
Re: Capturing Error message in a log file.
by jdporter (Paladin) on Jan 03, 2003 at 11:17 UTC |