Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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?
[stevieb]: cheers beech. twas totally my mistake, and I got bit. When things work for so long without issue, one becomes complacent (ie. replace we/one with I ;) I've been copy/pasting that around for a few years without a hiccup, so when...
[stevieb]: choroba pointed that out, I was just, you know, *sigh*. In effect, I was lucky and fortunate
[stevieb]: Kind of like my regex-fu went out the window, but only while looking at that specific file ;)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-07-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (383 votes). Check out past polls.