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;
my $rows = 0;
my $ref;
while($ref = $sth->fetch) {
print $fh $lsep if $rows++ and $lsep;
my $str = neat_list($ref,$maxlen,$fsep);
print $fh $str; # done on two lines to avoid 5.003 errors
}
print $fh "\n$rows rows".($DBI::err ? " ($DBI::err: $DBI::errstr)" : "")."\n";
$rows;
close(FH);
}
----------------------------------------------------------------
Craig Efrein
Assistant Systems Manager
San Diego Reader
Mailing: P.O. Box 85803, San Diego, CA 92186
Street: 1703 India St., San Diego, CA 92101
Phone: 619-235-3000, ext. 277 Fax: 619-231-0489