Subject: | PATCH: typo fixes and better error reporting |
When there was an error, there was no way to get to the underlying
"error_input" method. This patch adds that to the "errstr" output, and
cleans up a few typos of "CVS" as well. (I do the same thing!).
Mark
Subject: | typo_and_error_message.patch |
Wed Jun 6 14:02:10 EDT 2007 Mark Stosberg <mark@summersault.com>
* Parse::CSV improvements. fix "CVS" typos and return a more useful error message.
diff -rN -u old-museum-resources-alphasite/perllib/Parse/CSV.pm new-museum-resources-alphasite/perllib/Parse/CSV.pm
--- old-museum-resources-alphasite/perllib/Parse/CSV.pm 2007-06-06 14:03:52.000000000 -0400
+++ new-museum-resources-alphasite/perllib/Parse/CSV.pm 2007-06-06 14:03:52.000000000 -0400
@@ -4,7 +4,7 @@
=head1 NAME
-Parse::CSV - Highly flexible CVS parser for large files
+Parse::CSV - Highly flexible CSV parser for large files
=head1 SYNOPSIS
@@ -39,7 +39,7 @@
but unfortunately it can be a bit verbose to use.
A number of other modules have attempted to put usability wrappers around
-this venerable module, but they have all focussed on parsing the entire
+this venerable module, but they have all focused on parsing the entire
file into memory at once.
This method is fine unless your CSV files start to get large. Once that
@@ -298,7 +298,8 @@
while ( defined(my $line = $self->_getline) ) {
# Parse the line into columns
unless ( $self->{csv_xs}->parse($line) ) {
- $self->{errstr} = "Failed to parse row $self->{row}";
+ $self->{errstr} = "Failed to parse row $self->{row}.\n "
+ ."Error input was: ".$self->{csv_xs}->error_input;
return undef;
}
@@ -390,7 +391,7 @@
=head2 string
- $line = $cvs->string;
+ $line = $csv->string;
The C<string> method is provided as a convenience, and is passed through
to the underlying L<Text::CSV_XS> object.
@@ -405,7 +406,7 @@
=head2 print
- $status = $cvs->print($io, $columns);
+ $status = $csv->print($io, $columns);
The C<print> method is provided as a convenience, and is passed through
to the underlying L<Text::CSV_XS> object.