in reply to STDERR

jettero,

Update: Added clarification after seeing jettero's response. Left original post for context.

Would something like this help?

$errfile = qw( stderr.log ); open STDERR, ">$errfile"; die "And in that sleep of death, who knows what dreams may come...";

Clarification:

Sorry about the mixup. Here's something crude that seems to work on my machine. YMMV

#!\usr\bin\perl my @errors = (); my $ctr = 0; for ( $ctr = 0; $ctr < 10; $ctr += 1 ) { eval { if ( $ctr == 5 ) { die "Number 5 is not alive."; } }; if ( $@ ) { push ( @errors, $@ ); } } $ctr = @errors; if ( $ctr != 0 ) { for ( @errors ) { print "$_\n"; } } else { print "No errors found."; }

As I said, it's a bit tortured, but the idea is to wrap the DBI stuff into an eval block, pushing the problems onto @errors. Later, you can dump them to the screen, to a file, or whatever.

Sorry for the confusion...

--f

Replies are listed 'Best First'.
Re: Re: STDERR
by jettero (Monsignor) on Dec 20, 2000 at 01:55 UTC
    Acutally, no, since (as you recall) I want to store the lines of STDERR into an array, not a file.