[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Text::CSV




Does anybody here have experience using this module?

I don't know if my problems are pure ignorance (likely), or a feature of
the module, or a bug in the module, or a bug in the Mac XS version of it.

I'll try to cover the basics.

>From MS Access on a PC, I export a table as delimited text.  This is a CSV
file, note the PC line endings.  The database is such that it has
linebreaks inside the fields, i.e. it is binary.

I try to read in the file on the Mac using Text::CSV_XS, latest version
ported by Chris Nandor (thanks, Chris!).  I am using csv->getline, passing
it a FileHandle as needed.

If I convert the text file to a Mac file, and set EOL for CSV_XS to '\015'
or '\n' or '\012' or '' or '\015\012', CSV_XS cannot read any of it
(returns undef, no errors and no explanations or other info).

If I do NOT convert the file and set EOL to '\015\012', CSV_XS reads one
record's worth (20 fields with lots of stuff, including embedded
linebreaks), and then won't go any further.  It seems to leave the
end-of-line in the file, but even when I getc() past that, it won't get
the next record.  It once again returns the undef.

Is it possible there is some interaction between MacPerl's changing the
value of \n and this module's XS portion?

Or should I try some completely different method?

I thought about trying using DBD::CSV as a front-end to CSV, but I was
afraid if I couldn't get the simple piece to work, trying to master the
collection would be too much.  I'm a DBD newbie.  I don't even know if
DBD::CSV is available on the Mac.


--
MattLangford 


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org