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

Re: [MacPerl] Text::CSV_XS revisited




On Wed, 15 Sep 1999, Chris Nandor wrote:

> At 22:32 -0500 1999.09.14, Matthew Langford wrote:
> >I'm not sure why passing a DOS-formatted text file to it fails...It
> >apparently uses getline() to grab chunks of the file, but the recognition
> >engine goes byte by byte and should see every character regardless of how
> >the buffer is filled.
<snip>
> 
> I suspect that you are not setting the input record separator in Perl.
> That is, Text::CSV_XS has its getline method, which then calls IO::File's
> getline method, which relies on $/, the input record separator.

Ah, yes!  Thank you!

If I set  local($/) = "\015\012", I can read a DOS-formatted CSV file on
the Mac.  Of course, CSV is still broken in that I can't ever read a file
with Mac eols, but finding something that works was the main point.

What amazes me is that I had tried setting $/ to other things in another
place in the code, and still didn't think to do this.  Sometimes my
dimwittedness surprises even me.  Thanks for delivering the appropriate
conk to the head.


--
MattLangford 


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