Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by tfrayner (Curate)
on May 30, 2007 at 18:51 UTC ( #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?

Cheers,

Tim

  • 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 (Abbot) 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").

      Cheers,

      Tim

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


        Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://618266]
help
Chatterbox?
[hippo]: Yary: There are a few useful pointers in I need perl coding standards
[hippo]: ... and a boatload of good stuff in On Coding Standards and Code Reviews
[Yary]: Looking at system pm's, looks like it's "package" on the first line, then POD, then "use 5.xyz;use strict; use warnings; use modules..."
[Yary]: ah thanks for those links
[hippo]: Just bear in mind that all such ideas are subjective.
[choroba]: There might be a different standard at the shop you write the code for.
[choroba]: The order of package - (strict+warnings | warnings+strict) - modules makes sense, POD and strict-warnings order are not so important

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2018-01-23 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (250 votes). Check out past polls.

    Notices?