Skip Menu |

This queue is for tickets about the AnyData CPAN distribution.

Report information
The Basics
Id: 15706
Status: new
Priority: 0/
Queue: AnyData

People
Owner: Nobody in particular
Requestors: jtjm [...] xenoclast.org
Cc:
AdminCc:

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



Subject: CSV parser is broken by commas inside quotes
If a comma occurs inside a quoted string in a CSV file, AnyData seems unable to read it: $ cat > test.csv "here","there is","a","simple","csv","file" "a","b","c","d","e","f" ^d $ # This can be read as you'd expect: $ perl -e 'use AnyData;use Data::Dumper; $table = adTie("CSV", "test.csv"); foreach $key (keys %$table) {print $key." = ".Dumper($$table{$key})}' HASH(0x81b395c) = $VAR1 = [ { 'here' => 'a', 'csv' => 'e', 'a' => 'c', 'simple' => 'd', 'file' => 'f', 'there is' => 'b' } ]; $ cat > test.csv "here","there, is","a","simple","csv","file" "a","b","c","d","e","f" ^d $ # But now we introduce a comma after 'there', and it all goes to pot: $ perl -e 'use AnyData;use Data::Dumper; $table = adTie("CSV", "test.csv"); foreach $key (keys %$table) {print $key." = ".Dumper($$table{$key})}' HASH(0x81b383c) = $VAR1 = [ {}, {} ]; HASH(0x81b38f0) = $VAR1 = [ {}, {} ];