in reply to Re: Text::CSV_XS and line-endings
in thread Text::CSV_XS and line-endings

Hi, jZed, thanks for your reply.

I'm trying the simplest test case I could think of, but I can't get your suggestion to work. Here is what I'm trying.

#!/usr/bin/perl use strict; use warnings; use Text::CSV_XS; use Data::Dumper; use IO::File; my $fh = IO::File->new; $fh->open( "<test.csv" ) or die $!; my $c = Text::CSV_XS->new( { binary => 1, csv_eol => "\015" } ); my $d = $c->getline( $fh ); print Dumper( $d );

And test.csv contains:

foo,bar,baz^Mred,green,blue^Mnarf,blatz,quux

(Where ^M's are \r's)

That script results in $d being undef, as reported by Data::Dumper. Running the script on the same data with \n's instead of \r's works fine.

Replies are listed 'Best First'.
Re^3: Text::CSV_XS and line-endings
by jZed (Prior) on Mar 17, 2006 at 19:39 UTC
    Ooops, sorry, I was giving you DBD::CSV instructions, not Text::CSV_XS instructions, use "eol=>" instead of "csv_eol=>".
        Um, yeah, you're right. I am confusing myself with the various modules and posting before putting brain in gear. Please ignore me.
      I'm afraid that still gives me the same result. :(