On Thu, Mar 29, 2001 at 09:24:08AM -0800, Craig Efrein wrote:
> I have a repair to the dump_results sub routine of DBI.pm.
> 
> 
> Problem:
> Any attempts to send results of table dump to a file fail because of 
> call to STDOUT.  Replaced STDOUT with Open File command
> 
> Offending Code:
> $fh ||= \*STDOUT; e
> 
> Replaced With:
> open(FH, ">$fh") || return undef;
> $fh = \*FH;
> 
> and added a close to filehandle at bottom of subroutine.
> 
> 
> Entire sub routine
> sub dump_results {      # also aliased as a method in DBD::_::st
>     my ($sth, $maxlen, $lsep, $fsep, $fh) = @_;
>     return 0 unless $sth;
>     $maxlen ||= 35;
>     $lsep   ||= "\n";
>     #$fh ||= \*STDOUT; e
>     open(FH, ">$fh") || return undef;
>     $fh = \*FH;

For this to work, you would be passing a filename to dump_results, instead
of a filehandle.  That changes the interface, and will break any scripts
that rely on the current behavior of dump_results.

I think the offending code is actually where you are calling dump_results.
That's what should be fixed.

Ronald

Reply via email to