Skip Menu |

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

Report information
The Basics
Id: 122764
Status: resolved
Priority: 2/
Queue: Text-CSV_XS

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

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



Subject: Inconsistent behaviour from header() method with carriage return EOL's
We hit two issues when calling the header() method while parsing a CSV file that uses carriage returns for EOL: 1) *All* the data was lower cased, not just the header keys. If the data uses newline as the EOL character, only the header keys are lower cased, while the remaining rows maintain their case. Here's a code snippet to reproduce the issue. use Text::CSV_XS; use Data::Dumper; my $data = "foo,BAR,baz\rONE,two,Three\rFour,FIVE,six\r"; open my $fh, "<", \$data; my $csv = Text::CSV_XS->new({binary => 1}); $csv->header($fh); while (my $rec = $csv->getline_hr($fh)) { print Dumper $rec; } 2) If you explicitly add the option eol => "\r" when creating the Text::CSV_XS object in the above example, there is *no* output (the file handle is at EOF before the while loop is executed?). Using $csv->column_names($csv->getline($fh)); instead of header() was a sufficient workaround.
Subject: Inconsistent behaviour from header () method with carriage return EOL's
Sorry for the late reply. Been away for three weeks Thanks for the report. It is clear and concise and painfully shows two bugs I see the problem. I have to think about workable solutions.
I have now pushed a fix. Thanks again for this ticket. This was quite a tempting bug. $ git clone https://github.com/Tux/Text-CSV_XS Text-CSV_XS or get it as a tgz: $ wget --output-document=Text-CSV_XS-git.tgz \ https://github.com/Tux/Text-CSV_XS/archive/master.tar.gz If I do not get feedback, I will release next week or so.