Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 22007
Status: resolved
Priority: 0/
Queue: Parse-CSV

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

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



Subject: PATCH: bugfix for error handling in new()
Without this patch, the error message is never seen. It is stuffed in the object, but the object is not returned from new(), so it is inaccessible. The consistent and useful thing to do is just croak the error, which is how error handling in other parts of new() work. Mark
Subject: parse-csv.patch
--- old-alphasite/perllib/Parse/CSV.pm 2006-10-10 14:34:09.000000000 -0400 +++ new-alphasite/perllib/Parse/CSV.pm 2006-10-10 14:34:09.000000000 -0400 @@ -227,8 +227,7 @@ # Parse the line into columns unless ( $self->{csv_xs}->parse($line) ) { - $self->{errstr} = "Failed to parse header line from CSV"; - return undef; + Carp::croak("Failed to parse header line from CSV"); } # Turn the array ref into a hash if needed
Here's a possibly improved patch that passes through whatever error Text::CSV_XS had. Mark
--- old-alphasite/perllib/Parse/CSV.pm 2006-10-10 14:44:23.000000000 -0400 +++ new-alphasite/perllib/Parse/CSV.pm 2006-10-10 14:44:23.000000000 -0400 @@ -227,8 +227,8 @@ # Parse the line into columns unless ( $self->{csv_xs}->parse($line) ) { - $self->{errstr} = "Failed to parse header line from CSV"; - return undef; + Carp::croak("Failed to parse header line from CSV. The error returned was: " + .$self->{csv_xs}->error_input); }
Applied. Fixed in 1.00