RE: CSV problem on Solaris





A bit OT, but assuming it's a linefeed issue...

UltraEdit does offer linefeed options.
You can convert files using File -> Conversion -> ...
You can tell it whether to load/save in the Unix format using Advanced -> Configuration -> General.

-----Original Message-----
From: Garrett, Philip (MAN-Corporate) [mailto:Philip.Garrett@xxxxxxxxxxx]
Sent: Wednesday, June 28, 2006 7:22 AM
To: dbi-users@xxxxxxxx
Cc: Govinda.Pfister@xxxxxxxxxx
Subject: RE: CSV problem on Solaris

-----Original Message-----
From: Govinda.Pfister@xxxxxxxxxx [mailto:Govinda.Pfister@xxxxxxxxxx]
Sent: Wednesday, June 28, 2006 9:47 AM
To: Garrett, Philip (MAN-Corporate)
Subject: AW: CSV problem on Solaris

I do have a problem with a littler perl script I wrote. It uses
DBD:CSV and I don´t know why it doesn´t work as I would expect it.

[snip]

my $dbh = DBI->connect("DBI:CSV:");

Add this after connecting:
$dbh->{RaiseError} = 1;

This will cause DBI to die with an error message when there is a
problem.

Just inserted. Fired the script again.
The result is the same.

That probably means that you do indeed have a line-ending problem. I
have tested this on Solaris and I have the same problem. The issue is
that the default line ending for DBD::CSV is CR/LF (DOS format), but
(apparently?) UltraEdit uses Unix line endings (LF).

There are a couple of solutions:
* Use unix2dos to convert the CSV file format, or
* Specify line ending in the DBI connect call:
my $dbh = DBI->connect("DBI:CSV:csv_eol=\012");

Philip
.