On 6/27/07, Jay Savage <[EMAIL PROTECTED]> wrote:
snip
Make sure that the last record in your file is correctly terminated
(i.e. there are no unclosed quotes), and that the last record is
followed immediately by the final newline, which is alos the last
character of the file.
snip

Try applying the following patch against
$YOUR_PERL_DIR/Tie/Handle/CSV.pm.  It extends the error message on a
bad parse to make it more readable.

--- CSV.pm.bak  2007-06-27 14:39:54.000000000 -0400
+++ CSV.pm      2007-06-27 14:46:10.000000000 -0400
@@ -151,7 +151,7 @@
      if (defined $csv_line)
         {
         $opts->{'csv_parser'}->parse($csv_line)
-            || croak $opts->{'csv_parser'}->error_input();
+            || croak "could not parse: [" .
$opts->{'csv_parser'}->error_input() . "]";
         if ( $opts->{'header'} )
            {
            my $parsed_line = $opts->{'simple_reads'}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to