On Tue, 01 Jul 2003 16:12:09 -0600 Ian Harisay <[EMAIL PROTECTED]>
wrote:

> Doing the redirect can be a bit clunky.  If you want to be more
> precise with how you handle these errors, add this $attr to your
> connect statement.
> 
> my $attr = { PrintError => 0, RaiseError => 1, AutoCommit => 0 };
> my $dbh = DBI->connect( @{$login}, $attr )
>   or die "Can't connect to Oracle database: $DBI::errstr\n";
> 
> then when an error occurs it will not print to STDERR.  Rather it
> can be read thru $dbh->errstr.

Did you mean 'RaiseError => 0'?  With 'RaiseError => 1', connect() never
returns if an error occurs.  In either case (RaiseError or die), the
output goes to STDERR.

When I need to force STDERR to another place, I use open().
Note the autoflush() as well, otherwise the order of output lines
going to a file may be incorrect since STDERR is not buffered.

   open( LOG, ">> $file" );
   autoflush LOG 1;
   open( STDERR, ">&=" . fileno( LOG ) );

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.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.

Reply via email to