Subject: | csv_eol |
We have experienced some problems with one script:
[code]
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $file = './test.csv';
my $dbh = DBI->connect("DBI:CSV:f_dir=.;csv_sep_char=\\;") or die
$DBI::errstr;
$dbh->{csv_tables}->{'info'} = {file => $file};
my $sth = $dbh->prepare(q~SELECT * FROM info~);
$sth->execute();
while(my @row = $sth->fetchrow_array()){
@row = grep{defined $_ }@row;
print join("--",@row),"\n";
}
$sth->finish();[/code]
It works fine under Windows and breaks under Linux. We found out, that
we have to set csv_eol to \n.
In the sources there is the following line:
$opts{'eol'} = $meta->{'eol'} || $dbh->{'csv_eol'} || "\015\012";
Wouldn't it be better to say
$opts{'eol'} = $meta->{'eol'} || $dbh->{'csv_eol'} || $/;
to use the operating systems' specific newline?