Skip Menu |

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

Report information
The Basics
Id: 74506
Status: resolved
Priority: 0/
Queue: Text-xSV-Slurp

People
Owner: danboo [...] cpan.org
Requestors: pmcdermott98 [...] gsb.columbia.edu
Cc:
AdminCc:

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



Subject: Text::xSV::Slurp ignores Text::CSV eol setting when reading CSV file header
Date: Sun, 29 Jan 2012 15:58:21 +0000
To: bug-Text-xSV-Slurp [...] rt.cpan.org
From: Paul McDermott <pmcdermott98 [...] gsb.columbia.edu>
Text::xSV::Slurp appears to ignore any special line endings set for the CSV file via the 'eol' parameter to 'text_csv'. e.g. $aoh = xsv_slurp('file.csv', text_csv => {eol => "\015\012"}) This is because in Text::xCSV::Slurp::_as_aoh() chomp is used to remove the line ending. chomp is not aware of the eol setting. Using $csv->getline($handle) will get the header line line and parse it, using the 'eol' setting already passed to Text::CSV. The patch below fixes this issue for _as_aoh(), but Text::xCSV::Slurp may need fixing in other places. 607c607,613 < my $header = <$handle>; --- Show quoted text
> # Should use Text::CSV::getline here to ensure that any 'eol'
spec set for Show quoted text
> # Text::CSV via 'text_csv' is used > my $header = $csv->getline($handle); > > if (not defined $header and i( 0 + $csv->error_diag)) { > confess 'Error: '.$csv->error_diag; > }
612,619c618 < chomp( $header ); < < if ( ! $csv->parse($header) ) < { < confess 'Error: ' . $csv->error_diag; < } < < my @headers = $csv->fields; --- Show quoted text
> my @headers = @$header;
I've uploaded version 0.22 to CPAN with fixes and regression tests for all shapes. Thanks for the report. - danboo
Subject: Re: [rt.cpan.org #74506] Text::xSV::Slurp ignores Text::CSV eol setting when reading CSV file header
Date: Mon, 30 Jan 2012 14:28:06 +0000
To: bug-Text-xSV-Slurp [...] rt.cpan.org
From: Paul McDermott <pmcdermott98 [...] gsb.columbia.edu>
Daniel - Quick work. Well done! On 29/01/12 21:43, Daniel B. Boorstein via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=74506> > > I've uploaded version 0.22 to CPAN with fixes and regression tests for all > shapes. > > Thanks for the report. > > - danboo