Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: The future of Text::CSV_XS - TODO

by tfrayner (Curate)
on May 30, 2007 at 18:51 UTC ( [id://618266] : note . print w/replies, xml ) Need Help??

in reply to Re: The future of Text::CSV_XS - TODO
in thread The future of Text::CSV_XS - TODO

Thanks very much for looking at this. I've tried 0.27, and it shows the same problem (see my original node, updated, for a test of sorts). I looked through your eol tests, and checked on exactly what was being written out to the temporary file in the \r cases. It appears that in those cases the file is terminated with a \r\n, rather than just \r. I think this may be why your tests pass but mine doesn't?



  • Comment on Re^2: The future of Text::CSV_XS - TODO

Replies are listed 'Best First'.
Re^3: The future of Text::CSV_XS - TODO
by Tux (Canon) on May 30, 2007 at 22:55 UTC

    New snapshot just uploaded, in which eol => $/ is permitted for "\r". That extends successful parsing to line endings in the set undef, "\n", "\r\n", and "\r".

    Enjoy, Have FUN! H.Merijn
      Thanks, that's a huge improvement. I'm afraid I've discovered another slight wrinkle, though:
      use strict; use Text::CSV_XS; use IO::File; $/ = "\r"; my $f = IO::File->new_tmpfile; print $f ('a,b,c', $/, '"d","e","f"', $/); seek($f,0,0); my $c = Text::CSV_XS->new({ eol => $/ }); for(0..1){ print join("|",@{ $c->getline($f) })."\n" }
      The first getline works, but the second fails. It looks as though the quote characters are blocking recognition of \r as eol (again, the code here works if $/="\n").



        Thanks for testing further. Above situation fixed, and modified example added to testsuite. snapshot updated.

        Enjoy, Have FUN! H.Merijn