DamnDirtyApe has asked for the wisdom of the Perl Monks concerning the following question:

I recently encountered a problem with DBD::CSV that I thought I would ask about. I am in the process of migrating data from an Access database to an Oracle database. I had exported the Access tables to CSV files for my own reference, and then got the idea that I might be able to use DBD::CSV to read my text files and DBD::Oracle to write them to the Oracle database.

I was surprised to find that I could access CSV files that I had created with DBD::CSV, but not the text files I wanted to read. I finally determined the problem: DBD::CSV would not recognize files that did not have DOS-style (0d0a) line terminators. Being on a UNIX machine, I had to use the following filter to `fix' all of my CSV files:

perl -ne 's/\n/\r\n/; print;' OrigFile > FixedFile

My questions are:

  1. Is this a property of the module, or is this something I am doing incorrectly?
  2. If this is the way the module is intended to function, why? Is there a benefit that I'm not seeing?
  3. if this is a bug/shortcoming in the module, what is the proper way to request bug fixes/enhancements? Simply emailing the author, or is there a more controlled system?

Thanks for your time.


_______________
D a m n D i r t y A p e
Home Node | Email

Replies are listed 'Best First'.
Re: DBD::CSV Question
by cLive ;-) (Prior) on May 13, 2002 at 01:14 UTC
    You need to set the end of line attribute:
    my $dbh = DBI::connect_cached("DBI:CSV:f_dir=/whatever;csv_eol=\n");
    Note use of double quotes so \n is interpolated.

    here's the docs.

    cLive ;-)

    --
    seek(JOB,$$LA,0);