I do not see any code, so I cannot tell how you created the database connection. The use of csv_auto_diag, which is also automatically set when using the autodie module, might help you.

$ perl -MDBI -wle'DBI->connect("dbi:CSV:csv_auto_diag=1")->prepare("se +lect * from non_exist")->execute' DBD::CSV::st execute failed: Execution ERROR: Cannot open /home/merijn/non_exist: No such file or d +irectory (2) at /pro/lib/perl5/site_perl/5.10.1/x86_64-linux/DBD/File +.pm line 684 . [for Statement "select * from non_exist"] at -e line 1. $ perl -MDBI -wle'DBI->connect("dbi:CSV:csv_auto_diag=1")->prepare("se +lect * from empty_file")->execute' DBD::CSV::st execute failed: Execution ERROR: Missing first row at /pro/lib/perl5/site_perl/5.10.1/ +x86_64-linux/DBD/File.pm line 684 . [for Statement "select * from bin"] at -e line 1. $

The second will also occur when the table cannot be opened as a file, e.g. when it is a folder or when the first line contains a (serious) error. If the header line was fine, errors in the data lines will now be printed immediately:

$ perl -MDBI -wle'DBI->connect("dbi:CSV:csv_auto_diag=1")->prepare("se +lect * from bad")->execute' DBD::CSV::st execute failed: Error 2034 while reading file /home/merij +n/bad: EIF - Loose unescaped quote at /pro/lib/perl5/site_perl/5.10.1 +/SQL/Statement.pm line 1032 [for Statement "select * from bad"] at -e line 1. $

I'll have a look if I can make the error reporting from the middle one (cannot open, empty file or bad header) a bit better.


Enjoy, Have FUN! H.Merijn

In reply to Re: Error with DBD::CSV by Tux
in thread Error with DBD::CSV by digger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.