The error is from perl itself, not from the CSV parser. It happens deep in the bowels of the code:

sv_setiv (*svp, SvIV (*svp));

because you specified types, and an empty string is not a number:

$ perl -wE'my $int = 1 + ""' Argument "" isn't numeric in addition (+) at -e line 1.

It is (very) easy to alter the code to make IV and NV types forced return of 0 or 0.0 on empty and undef fields, but that would cause backward incompatibilities and I doubt if it warrants a new attribute/options. Besides, you can already guard your own code against this:

$ perl -wE'no warnings "numeric";my $int = 1 + ""' $

Or in your own script:

while (my $colref = eval { no warnings "numeric"; $csv->getline_hr ($f +h)}) {

Also note that perl does the richt thing anyway:

say "$_ $names->[$_]\t$colref->{$names->[$_]}" for grep { $types->[$_] == Text::CSV_XS::IV } 0 .. $#$types; -> End of line processing Argument "" isn't numeric in subroutine entry at /pro/3gl/CPAN/Text-CS +V_XS/blib/lib/Text/CSV_XS.pm line 871, <$fh> line 3. New line status: error_input: error_diag: 2 Volume.serialno 3643411828 3 vtype 4 7 skip002 1 8 skip003 0 9 skip004 260 12 skip005 0 13 skip006 2147483648 14 Thumbnail.width 400 15 Thumbnail.height 400 16 skip007 0 17 skip008 0 18 skip009 3 19 skip010 24 20 skip011 0 21 skip012 172 22 skip013 200 23 skip014 518 24 skip015 3603 29 skip017 0

Enjoy, Have FUN! H.Merijn

In reply to Re: Unable to detect error from Text::CSV by Tux
in thread Unable to detect error from Text::CSV by dd-b

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.