This is a follow-up on my previous post on Text::CSV_XS
I have been digging a bit to find what people consider loose ends in Text::CSV_XS, and tried to summarize that (in no particular order) in the new TODO list. Here TODO gives no guarantee that it will be done, nor on any implementation or API that it might suggest, it is there now just so I/we do not forget to think about these issues.
I'd like to get thoughts/feedback/suggestions about items on this list, and how valuable you consider adding these features to a modules so heavily used by other applications.
jZed asked me to also post to this to the dbi-users list, cause many DBI users (have to) deal with CSV data, which I already did. So start shooting ...
New extensions ought to be clear and concise in reporting what error occurred where and why, and possibly also tell a remedy to the problem. error_diag is a (very) good start, but there is more work to be done here.
Basic calls should croak or warn on illegal parameters. Errors should be documented.
Future extensions might include extending the meta_info (), is_quoted (), and is_binary () to accept setting these flags for fields, so you can specify which fields are quoted in the combine ()/string () combination.
$csv->meta_info (0, 1, 1, 3, 0, 0); $csv->is_quoted (3, 1);
Requests for adding means (methods) that combine combine () and string () in a single call will not be honored. Likewise for parse () and fields (). Given the trouble with embedded newlines, Using getline () and print () instead is the preferred way to go.
The hard-coding of characters and character ranges makes this module
unusable on EBCDIC system. Using some #ifdef structure could enable
these again without loosing speed. Testing would be the hard part.
The most current state is available on the public GIT repo.
|
---|
Replies are listed 'Best First'. | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Dec 19, 2024 at 14:55 UTC | ||||||||||||||||||||||||||||||||
News from the trenches: a new attribute strict_eol will be available in the next release: strict_eol
If this attribute is set to 0, no EOL consistency checks are done. If this attribute is set to 1, any row that parses with a EOL other
than the EOL from the first row will cause a warning. If this attribute is set to 2 or higher, any row that parses with a EOL
other than the EOL from the first row will cause Any feedback welcome ... The function (method) csv () will use the warning level by default. There are still some edge-cases that might need a change, but the basics have settled. Als always, you can get a pre-release from github.
Edge case example:
The edge cases could also be considered "wrong" in all previous releases, and when strict_eol is disabled, Older highlights since 1.49 ...
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on May 30, 2007 at 08:17 UTC | ||||||||||||||||||||||||||||||||
Small updates I now understand the fuzz people make about embedded newlines. Text::CSV_XS has always been able to deal with that (well, maybe not always, but at least for a long time already). The problem that people might have is reading the line in the perl script. Obviously,
Will horribly fail, as <> will break too early. The most recent snapshot now contains a t/45_eol.t, that tests all possible eol combinations. Have a look to see that the way to parse CSV with embedded newlines should be done similar to:
or, if you open files yourself, like:
I'm still thinking about the best way to add this to the docs. Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by tfrayner (Curate) on May 30, 2007 at 18:51 UTC | ||||||||||||||||||||||||||||||||
Cheers, Tim | [reply] | |||||||||||||||||||||||||||||||
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 | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by tfrayner (Curate) on May 31, 2007 at 09:32 UTC | ||||||||||||||||||||||||||||||||
by Tux (Canon) on May 31, 2007 at 10:39 UTC | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Sep 16, 2019 at 10:03 UTC | ||||||||||||||||||||||||||||||||
And again, a lot of water has flown through <your favorite river>, so some highlights that might affect the end-users... Personally I see myself going to use the stacked encoding quite a bit in the future:
1.40 - 2019-09-15
1.39 - 2019-03-15
1.38 - 2018-12-30
1.37 - 2018-09-27
1.36 - 2018-06-26
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jul 22, 2020 at 19:19 UTC | ||||||||||||||||||||||||||||||||
I finally was able to strike the EBCDIC TODO-item. After Karl and I got perl-5.32.0 built on z/OS EBCDIC native with dynamic loading and threads, the next step was to get Text::CSV_XS passing all tests on it. We need a goal, and this one was a real challenge, but it now works, out of the box! (I updated the TODO list in the OP) I just released 1.44, which was also tested with the new (not set in stone) defaults that the core development team envisions for perl-7, and everything passes \o/ Check out the updated tools: csv-check and csv2xlsx. 1.44 - 2020-07-221.43 - 2020-05-271.42 - 2020-05-191.41 - 2020-02-16Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jun 01, 2007 at 07:00 UTC | ||||||||||||||||||||||||||||||||
Thanks for the links. I'll scan them. Meanwhile Text::CSV_XS 0.27 has left the building and should be available to all when CPAN synced your favourite mirror.
Work already progresses for the next snapshot that is to include ways to allow buggy formats
I'm playing to see if allow_whitespace is also feasable Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by snoopy (Curate) on Jun 01, 2007 at 02:12 UTC | ||||||||||||||||||||||||||||||||
I'm sure there's lots more. Text::CSV_XS should be in the standard Perl distribution!!! | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by tfrayner (Curate) on May 28, 2007 at 22:57 UTC | ||||||||||||||||||||||||||||||||
I think that making the eol option actually honour $/ would be extremely useful, and I think your suggested API for that would work fine. As I understand it (and the current behaviour of Text::CSV_XS certainly seems to bear me out) the module only handles \015\012 and \012 as CSV line endings for parsing input. It would be tremendously helpful if \015 was also supported. I'm assuming it's not, since I've never been able to get it to work despite occasional attempts over the years. There's also a note in the POD (CAVEATS) suggesting that alternate line endings are unsupported. I'm often surprised at the number of people out there still using spreadsheet software that generates CSV files with \015 line endings. I think older Mac OS machines, and some ill-behaved Mac OSX applications are at fault (if fault it really is). Cheers, Tim Update: based on the principle that every bug report should at least take a stab at giving a test case, here's what I'm talking about: That should output "a|b|c", and indeed does if $/ is set to \n or \r\n. Just clearing up any possible misunderstandings :-) | [reply] [d/l] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Nov 21, 2008 at 15:12 UTC | ||||||||||||||||||||||||||||||||
A test case calls for proof :)
Generates:
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jun 18, 2007 at 14:33 UTC | ||||||||||||||||||||||||||||||||
Thanks to all the feedback from all the different corners of the perl community, I'm doing far more than I planned :) Feel free to comment, request features, or give feedback on whatever part of this module you want. Meanwhile, 0.30 will leave for the wild wide world soon ...
The release candidate is up for you to test. Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Mar 21, 2018 at 14:42 UTC | ||||||||||||||||||||||||||||||||
A lot of water flowed through many rivers and a lot of tests have been executed since 1.10. I'll show the highlights ... My reason to join PerlMonks many eons ago was to get a grasp on what CSV problems were encountered by users of CSV parsers, and I am so happy with all the feedback I got both here and in the ChatterBox. THANK YOU ALL! The git repo now has a documentation section with preformatted HTML en MarkDown. 1.35 - 2018-03-211.34 - 2017-11-051.33 - 2017-10-191.32 - 2017-09-151.31 - 2017-06-131.30 - 2017-06-081.29 - 2017-04-251.28 - 2017-03-221.27 - 2017-03-021.26 - 2016-11-291.25 - 2016-08-281.24 - 2016-07-091.23 - 2016-03-251.22 - 2016-02-231.21 - 2016-01-061.20 - 2015-10-091.19 - 2015-06-171.18 - 2015-05-221.17 - 2015-04-241.16 - 2015-03-021.15 - 2015-02-111.14 - 2015-02-021.13 - 2015-01-031.12 - 2014-11-011.11 - 2014-08-16Enjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jun 21, 2022 at 14:14 UTC | ||||||||||||||||||||||||||||||||
I think my recent changes to csv2xlsx warrants an update. As this is on github but not yet released, feel free to comment on the new -S/--split feature, so I can update the docs or amend the code. To explain the new options: I was faced with a 50_000 line CSV file that had logical vertical sections. The section start was clearly marked. Say you have a CSV file with orders per customer, grouped by customer, and every such section starts with Customer,34526,"Foo Tool Factory",20220601,... followed by the orders. What I wanted was to convert this CSV to Excel (as required by the other end) where each customer had its own sheet. With the new options that would be:
Start a new sheet when column A is "Customer" and then use the value in column C for the matching record as label for the sheet. -S (or --split) also supports syntax for regex/empty/undef/compare and can be stacked. Here are the highlights of changes since my previous posts: 1.49 - 2022-06-21
1.48 - 2022-05-24
1.47 - 2021-12-21
1.46 - 2021-03-24
1.45 - 2020-12-24
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by Your Mother (Archbishop) on Jun 22, 2022 at 02:27 UTC | ||||||||||||||||||||||||||||||||
This thread++ lead to You have 1 vote left today:P | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Aug 04, 2014 at 13:12 UTC | ||||||||||||||||||||||||||||||||
This is likely the release that took me longest to test, but it now passes under 80 versions of perl ranging from 5.6.1 to 5.21.1 on OS's I had (indirect) access to: HP-UX 10.20, 11.00, 11.11, 11.23pa, 11.23ipf, 11.31, AIX-5.3, Win7, MacOSX, NetBSD, cygwin and of course Linux 32bit and 64bit. Version 1.10 supports multi-byte separation characters, which means that you now can use Unicode characters like \N{INVISIBLE SEPARATOR}, \N{FULLWIDTH COMMA} or even \N{SNOWMAN}. This release opens development for also supporting multi-byte quotation. More on that later. 1.10 - 2014-08-021.09 - 2014-06-09I want to thank all of those that provided feedback to my questions. Enjoy! Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Oct 24, 2007 at 12:24 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Oct 24, 2007 at 13:07 UTC | ||||||||||||||||||||||||||||||||
And a new speed comparison table. 0.23 .. 0.32 are Text::CSV_XS, and 1.00 .. 1.06 are Text::CSV_PP. I have no idea why 1.06 is not yet on CPAN.
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Apr 16, 2008 at 14:23 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Apr 23, 2008 at 11:11 UTC | ||||||||||||||||||||||||||||||||
The upcoming 0.44 will have:
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Oct 31, 2008 at 12:14 UTC | ||||||||||||||||||||||||||||||||
With the bugfix in 0.58, the Devel::Cover coverage (including XS) went up to 99.8%!
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Mar 01, 2008 at 17:02 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Apr 07, 2008 at 13:05 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by talexb (Chancellor) on Jul 24, 2025 at 14:17 UTC | ||||||||||||||||||||||||||||||||
I don't know what the source of the problem is, but I'm posting to note that the Issues link from the CPAN page is broken. I was impressed to see that there was only one issue, and wanted to check out what it might be. And also, I use Text::CCSV in my current work, and it's awesome to use. I had been using just but replaced that with and it was delightful to look at the result, and see that the data files looked almost exactly the same -- except just a few of the strings were quoted. So beautiful. | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Jul 24, 2025 at 15:23 UTC | ||||||||||||||||||||||||||||||||
If you think the commits on Text::CSV_XS warrent a release, I'll consider. Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
by talexb (Chancellor) on Jul 25, 2025 at 13:19 UTC | ||||||||||||||||||||||||||||||||
Thanks for these updates! I just happened to visit your profile, saw your ask to visit an old node (as one does), and posted an update. I believe the XS module gets automatically pulled in by the main module if the environment warrants. Whatever's actually being used, the module is terrific -- I've used it on and off since 2016, and probably before that as well. Awesome work. Thanks again. | [reply] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Jul 27, 2025 at 10:17 UTC | ||||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Sep 01, 2008 at 07:32 UTC | ||||||||||||||||||||||||||||||||
It is very good to see people are actually using error_diag (), but it also means people find bugs.
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Mar 06, 2008 at 08:13 UTC | ||||||||||||||||||||||||||||||||
I finally scratched a longstanding personal itch. No more need for 'useIO::Handle;'. Text::CSV_XS will now do that for you automatically at the moment it is needed, and only once, so no performance penalty. This will simplify one-liners.
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Mar 11, 2008 at 18:15 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Oct 15, 2009 at 06:38 UTC | ||||||||||||||||||||||||||||||||
Mac users rejoyce! I've come to the point where I now really think that for normal CSV, you won't have to set the eol attribute anymore for parsing CSV data. All off \n, \r\n, and now also \r are automatically recognized in streams. 2009-10-10 0.69 - H.Merijn Brand2009-10-04 0.68 - H.Merijn Brand2009-08-08 0.67 - H.Merijn BrandEnjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Apr 11, 2008 at 10:27 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jun 21, 2008 at 12:51 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Dec 25, 2010 at 10:53 UTC | ||||||||||||||||||||||||||||||||
Here's my X-Mas present: 0.80 - 2010-12-240.79 - 2010-11-260.78 - 2010-11-26The two new methods:Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by dipster (Novice) on Oct 30, 2007 at 08:03 UTC | ||||||||||||||||||||||||||||||||
Firstly, what a great module, thanks! I've always found it reliable and effective. It would be handy if string() returned the string read by getline(). Although this does seem to work...
What do you think? Would it be possible for Text::CSV_XS to return the string more efficiently? I've also wondered whether eol would always be limited to a finite set of predefined strings?
Thanks again. | [reply] [d/l] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Oct 30, 2007 at 17:06 UTC | ||||||||||||||||||||||||||||||||
That could be done, but not by default, as this has a big impact on performance, as now every getline () result has to be copied/stored in a location that string () can return to the user. The solution you post is only viable if the input stream is seek'able, and will not work on pipes. This is one of the reasons why this module is not capable of determining the line characteristics on the fly. Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on May 20, 2014 at 07:23 UTC | ||||||||||||||||||||||||||||||||
You might thank Lady_Aleena for my motivation, but the new csv () function has reached a state that pleases most people I talked to, but still having the possibilities to go wild. Read the docs 1.08 - 2014-05-171.07 - 2014-04-281.06 - 2014-04-201.05 - 2014-03-021.04 - 2014-02-06Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by markjugg (Curate) on Jun 24, 2008 at 12:43 UTC | ||||||||||||||||||||||||||||||||
I know some rows will be too short. I just want to skip them or log them and move on. Or maybe there's a a way I can "pre-test" them before calling getline()? | [reply] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Jun 25, 2008 at 07:15 UTC | ||||||||||||||||||||||||||||||||
Text::CSV_XS comes with examples. There is csv-check and parser-xs.pl. Both show ways to parse (broken) CSV files reliably. Take the latter as an example. Making fatal errors recoverable is very hard, as the module does not buffer. Once the stream has been read, it is hard to backup in it. You can still probably use $csv->error_input () after a caught eval'ed failure. Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Oct 15, 2008 at 11:14 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jan 23, 2009 at 09:15 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Apr 03, 2009 at 20:51 UTC | ||||||||||||||||||||||||||||||||
Three more releases later. People still make me find hidden features/bugs :)
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on May 15, 2009 at 06:55 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on May 04, 2010 at 12:11 UTC | ||||||||||||||||||||||||||||||||
2010-05-03 0.73 - H.Merijn BrandTogether with the 1.611 release of DBI, it made a new release possible for DBD::CSV 2010-05-03 DBD::CSV-0.29Some highlights from over the past few releases: Which leads you to:
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Oct 21, 2008 at 20:26 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Mar 08, 2009 at 10:31 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Sep 29, 2010 at 15:49 UTC | ||||||||||||||||||||||||||||||||
2010-09-29 0.74 - H.Merijn BrandThis release passed 35 versions of perl on a single box using a slightly modified version of Module::Release :) Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Oct 13, 2010 at 07:15 UTC | ||||||||||||||||||||||||||||||||
2010-10-09 0.76 - H.Merijn Brand2010-10-05 0.75 - H.Merijn BrandThe fix in version 0.75 is a serious fix. Version 0.76 was just released because it broke CPANTESTERS on Windows. There has been no functionality change in 0.76 at all. I now have a graphical representation of speed differences between Text::CSV_XS and Text::CSV_PP. The first shows the difference between XS and PP. The second just shows XS method differences. Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
by Anonymous Monk on Oct 13, 2010 at 07:27 UTC | ||||||||||||||||||||||||||||||||
Please forward that bug upstream | [reply] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Oct 13, 2010 at 07:34 UTC | ||||||||||||||||||||||||||||||||
I already posted the problem on the perl5 porters mailing list. I don't know if it is Test::more or something else that is to blame. Enjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by ikegami (Patriarch) on Dec 19, 2024 at 15:42 UTC | ||||||||||||||||||||||||||||||||
csv() is unexpectedly restrictive, and non-streaming. It would be nice if the following would work, and processed records one at a time instead of slurping the whole file.
It does suggest how the call could be rewritten so the above works (nice), but it loads the entire file. Honestly, I just want jq to support CSV :) (It can generate it, but not read it.) | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Dec 19, 2024 at 17:38 UTC | ||||||||||||||||||||||||||||||||
Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by ikegami (Patriarch) on Dec 19, 2024 at 20:40 UTC | ||||||||||||||||||||||||||||||||
It's the inconsistency of it.
The instruction to the programmer is doubly weird because it could simply do what it would do if the programmer used the suggested code. | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Dec 27, 2024 at 09:29 UTC | ||||||||||||||||||||||||||||||||
by ikegami (Patriarch) on Dec 19, 2024 at 20:09 UTC | ||||||||||||||||||||||||||||||||
You can encode as a stream. You can decode as a stream. But you can't transform as a stream. The inner call (csv (in => "a.csv, ...)) loads the entire file into memory. | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jun 15, 2012 at 06:16 UTC | ||||||||||||||||||||||||||||||||
I have just uploaded version 0.90 to CPAN, which marks a bigger step than the usual releases, as I have dropped perl-5.005 support. Perl 5.6.1 is now the minimum. 0.90 - 2012-06-150.88 - 2012-03-160.87 - 2012-03-080.86 - 2012-01-220.85 - 2011-09-070.84 - 2011-09-070.83 - 2011-08-07Enjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jan 13, 2013 at 18:39 UTC | ||||||||||||||||||||||||||||||||
Several small fixes, but 0.94 might fix more than you needed 0.95 - 2013-01-130.94 - 2012-12-030.93 - 2012-11-19Enjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jan 21, 2014 at 16:02 UTC | ||||||||||||||||||||||||||||||||
Twitter hinted me to implement RFC7111. See syntax below. If no (serious) objections, I will make a new release soon. 1.03 - 2014-01-21Read more... (2 kB)
1.02 - 2013-09-251.01 - 2013-06-16Enjoy, Have FUN! H.Merijn | [reply] [d/l] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Aug 07, 2009 at 14:34 UTC | ||||||||||||||||||||||||||||||||
2009-08-07 0.66 - H.Merijn BrandEnjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Feb 17, 2010 at 10:22 UTC | ||||||||||||||||||||||||||||||||
2010-02-15 0.71 - H.Merijn Brand2009-12-02 0.70 - H.Merijn BrandEnjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Nov 26, 2010 at 14:53 UTC | ||||||||||||||||||||||||||||||||
2010-10-23 0.77 - H.Merijn BrandEnjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Nov 13, 2012 at 13:05 UTC | ||||||||||||||||||||||||||||||||
A serious UTF-8 fix: output could be broken if buffer bounds cut encoded code points in half. 0.92 - 2012-11-120.91 - 2012-08-21Enjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Jun 13, 2013 at 18:04 UTC | ||||||||||||||||||||||||||||||||
I was inevitable, but with the steady releases, I was bound to hit 1.00. Here it is 1.00 - 2013-06-130.99 - 2013-06-050.98 - 2013-06-030.97 - 2013-03-300.96 - 2013-03-26Enjoy, Have FUN! H.Merijn | [reply] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by Tux (Canon) on Mar 16, 2010 at 13:08 UTC | ||||||||||||||||||||||||||||||||
2010-03-16 0.72 - H.Merijn BrandI also added a test to make sure a former inconsistency between Text::CSV_XS and Text::CSV_PP is tested for. Enjoy, Have FUN! H.Merijn | [reply] [d/l] [select] | |||||||||||||||||||||||||||||||
Re: The future of Text::CSV_XS - TODO
by XonqNopp (Initiate) on Feb 05, 2014 at 15:18 UTC | ||||||||||||||||||||||||||||||||
Hi and thanks for this great module, I was wondering if you could add an option (unless it already exists and I missed it in the documentation). I am currently dealing with CSV files that were transmitted from a remote computer somewhere in the nature to our server. There are often lines corrupted, meaning they can have more or less values than the header. I want to skip them (because they are corrupted) but not die the program (because next lines are good). I use the bind_columns but when there are more values I get the 3006 error and it gets out of the while. Putting an error_diag right after the while loop and checking for the 3006 error, I can then say goto beginning_of_loop, but this is not the solution I prefer... And I could not check if there was enough values to match the headers... So what I imagine is an option in the constructor letting the programer choose if the number of columns matches the header (if any) goes on without reporting, make a warning that could go invisible or fetched in error_diag or make the usual error as now (unseen if no auto_diag but dies anyway). But I let you deal with the 'how'... XN | [reply] [d/l] | |||||||||||||||||||||||||||||||
by Tux (Canon) on Mar 31, 2014 at 12:47 UTC | ||||||||||||||||||||||||||||||||
As of Text::CSV_XS-1.05, you can catch/ignore any error at your own risk:
Note that this API is young and new. New insights might enhance or change later on. Enjoy, Have FUN! H.Merijn | [reply] [d/l] |