Skip Menu |

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

Report information
The Basics
Id: 30620
Status: rejected
Priority: 0/
Queue: Text-CSV_XS

People
Owner: HMBRAND [...] cpan.org
Requestors: wonko [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.32
Fixed in: (no value)



Text::CSV_XS version 0.32 has problems parsing the sample attached file. I've tried all kinds of combinations of things to pass to new() but it still won't work quite right. The "first name" field should be John M. "Jack" But instead it becomes: John M. Jack Thompson And the "last name" field is shifted over and becomes the next field and last field is empty. So dumped it should be: $VAR1 = [ 'John M. "Jack"', 'Thompson', 'Never Subscribed' ]; But instead it's $VAR1 = [ 'John M. Jack Thompson', 'Never Subscribed' ]; Here's how I'm calling it: Text::CSV_XS->new( { sep_char => "\t", quote_char => undef, binary => 1, } );
Subject: test.tsv
From: HMBRAND [...] cpan.org
On Fri Nov 09 12:05:36 2007, WONKO wrote: Show quoted text
> Text::CSV_XS version 0.32 has problems parsing the sample attached
file. I see no attached file, so I cannot analyze the problem.
On Fri Nov 09 13:23:40 2007, HMBRAND wrote: Show quoted text
> On Fri Nov 09 12:05:36 2007, WONKO wrote:
> > Text::CSV_XS version 0.32 has problems parsing the sample attached
> file. > > I see no attached file, so I cannot analyze the problem.
It's listed right there under the "Attachments" section. I'll attach it again.
FIRST_NAME LAST_NAME SUBSCRIPTION_STATUS John M. "Jack" Thompson Never Subscribed
From: HMBRAND [...] cpan.org
% cat -ve test.tsv FIRST_NAME LAST_NAME SUBSCRIPTION_STATUS^M$ John M. "Jack" Thompson Never Subscribed^M$ % perl -MIO::Handle -MText::CSV_XS -le'$csv=Text::CSV_XS->new ({quote_char=>"\0",sep_char=>"\t",escape_char=>"\0"});while($f=$csv- Show quoted text
>getline(\*STDIN)){print"<",join(">,<",@$f),">"}' < test.tsv
<FIRST_NAME>,<LAST_NAME>,<SUBSCRIPTION_STATUS> <John M. "Jack">,<Thompson>,<Never Subscribed> % Or, formatted a bit use strict; use warnings; use IO::Handle; use Text::CSV_XS; my $csv = Text::CSV_XS-> new ({ binary => 1, # Always use binary :) sep_char => "\t", # Sep is TAB quote_char => "\0", # No quote char (default would take ") escape_char => "\0", # No escape char (default would take ") }); while (my $f = $csv->getline (\*STDIN)) { print "<", join (">,<", @$f), ">"; }
Not a bug. Not a CSV file, but Text::CSV_XS can still parse it :)