Skip Menu |

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

Report information
The Basics
Id: 99589
Status: resolved
Priority: 0/
Queue: Text-CSV

People
Owner: Nobody in particular
Requestors: tsibley [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.32
Fixed in: (no value)



Subject: Parsing failure with allow_loose_quotes + embedded newlines is correctly handled by Text::CSV_XS
The attached reproduction script produces the following output for me. Note that the pure-Perl parser incorrectly returns two rows while the XS parser does not. If allow_loose_quotes is not enabled, both parsers return the first, expected results. # input "foo loo","bar loo", baz # Text::CSV_XS version 1.11 $row1 = [ "foo\nloo", "bar loo", " baz" ]; # Text::CSV_PP version 1.31 $row1 = [ "\"foo" ]; $row2 = [ "loo\"", "bar loo", " baz" ]; Thomas
Subject: csv-parse-bug.pl
#!/usr/bin/env perl use strict; use warnings; use autodie; use Data::Dumper; use Text::CSV_PP; use Text::CSV_XS; $Data::Dumper::Useqq = 1; my $input = <<''; "foo loo","bar loo", baz print "# input\n", $input; for my $impl (qw(XS PP)) { my $class = "Text::CSV_$impl"; my $csv = $class->new({ binary => 1, eol => $/, allow_loose_quotes => 1, }) or die $class->error_diag . "\n"; open my $fh, '<', \$input; my $count = 1; print "\n# $class version ", $class->VERSION, "\n"; while (my $row = $csv->getline($fh)) { print Data::Dumper->Dump([ $row ], [ "row".$count++ ]); } }
On Mon Oct 20 14:37:57 2014, TSIBLEY wrote: Show quoted text
> The attached reproduction script produces the following output for me. > Note that the pure-Perl parser incorrectly returns two rows while the > XS parser does not. If allow_loose_quotes is not enabled, both > parsers return the first, expected results. > > # input > "foo > loo","bar loo", baz > > # Text::CSV_XS version 1.11 > $row1 = [ > "foo\nloo", > "bar loo", > " baz" > ]; > > # Text::CSV_PP version 1.31 > $row1 = [ > "\"foo" > ]; > $row2 = [ > "loo\"", > "bar loo", > " baz" > ]; > > Thomas
Fixed in 1.91. Thanks.
On Mon Oct 20 14:37:57 2014, TSIBLEY wrote: Show quoted text
> The attached reproduction script produces the following output for me. > Note that the pure-Perl parser incorrectly returns two rows while the > XS parser does not. If allow_loose_quotes is not enabled, both > parsers return the first, expected results. > > # input > "foo > loo","bar loo", baz > > # Text::CSV_XS version 1.11 > $row1 = [ > "foo\nloo", > "bar loo", > " baz" > ]; > > # Text::CSV_PP version 1.31 > $row1 = [ > "\"foo" > ]; > $row2 = [ > "loo\"", > "bar loo", > " baz" > ]; > > Thomas
Fixed by Text::CSV(_PP) 1.91. Thanks.