[Pdx-pm] reading a broken CSV file

Eric Shore Baur ebaur at aracnet.com
Mon Nov 24 10:04:09 CST 2003

	Sorry for being quiet for a couple days... got busy.  :)  At any
rate, this was kind of an old program and (if I remember correctly)
DBD:CSV was not handling things properly at the time... it sounds like it
does handle embeded newlines properly now, so I just need to give it
another go.
	On the other hand, I may be able to do some pre-processing, like
another post suggested.  I was trying to make sure I had the right line
and put it into the database all at the same time... I think its a much
better idea to make two passes instead.

Thanks for all the suggestions,

On Fri, 21 Nov 2003, Jeff Zucker wrote:

> Colin Kuskie wrote:
> >Get a line.
> >Feed it into some module that handles CSV and returns an array of elements
> >
> If that module is Text::CSV_XS, then the rest of this is irrelevant
> because it handles embedded newlines.  But since Eric is dealing with
> DBI and a database already, I can't think of any reason that DBD::CSV
> isn't the right tool for this job, but I'm prejudiced.
> >Do I have enough columns?
> >NO: Remove newline from present line;
> >    Fetch another line from file;
> >    Append it to the current line and check again.
> >YES: Push data into database.
> >
> Text::CSV_XS and DBD::CSV do all that for you.

More information about the Pdx-pm-list mailing list