Skip Menu |

This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id: 43378
Status: resolved
Priority: 0/
Queue: Text-CSV_XS

People
Owner: Nobody in particular
Requestors: m2 [...] strathcom.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: 0.28



Subject: Suspected bug
Date: Tue, 17 Feb 2009 18:11:28 -0700
To: bug-Text-CSV_XS [...] rt.cpan.org
From: matt hilliard <m2 [...] strathcom.com>
Hi. First, thanks for the awesome module. We get a lot of garbage CSV at my business and this module has saved us a lot of time, pulling data over the last year. I think I've hit a bug which is really easy to recreate: my $csv = Text::CSV_XS->new( { 'allow_whitespace' => 0, 'allow_loose_quotes' => 1, 'allow_loose_escape' => 1, 'quote_char' => '"', 'escape_char' => "\\", 'binary' => 1, 'eol' => $/ } ); returns undef for $csv. The OS is 6.2-RELEASE The perl is v5.8.8 built for i386-freebsd-64int The Text::CSV_XS is 0.60 (but behaviour was first observed with 0.51) If there's a caveat, please let me know what it is so I can work around the issue--this module has seen a lot of use but this is the first time we've used 'allow_loose_escape' (our latest data provider is flippant about escaping both single (') and double quotes (") inside a double-quoted string so I suspect that's the culprit). Best, Matt
Not a bug. You're missing an 's' If you would have used error_diag (), it would have told you: my $csv = Text::CSV_XS->new ({ ... }); Text::CSV_XS->error_diag (); => # CSV_XS ERROR: 1000 - Unknown attribute 'allow_loose_escape' allow_loose_escapes By default, parsing fields that have "escape_char" characters that escape characters that do not need to be escaped, like: my $csv = Text::CSV_XS->new ({ escape_char => "\\" }); $csv->parse (qq{1,"my bar\'s",baz,42}); would result in a parse error. Though it is still bad practice to allow this format, this option enables you to treat all escape character sequences equal.