X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FHelper%2FCsv.pm;h=3f4eaaaa3727de05a6500fd0ea73a59ecc3f862a;hb=e90048c8180f32f52f3f12ee52eb7269c4b27fcf;hp=e48161492a9703e94ef544820a7cd1efcb248880;hpb=781c16772f3c80cc827f11815bfb07b8318621f0;p=kivitendo-erp.git diff --git a/SL/Helper/Csv.pm b/SL/Helper/Csv.pm index e48161492..3f4eaaaa3 100644 --- a/SL/Helper/Csv.pm +++ b/SL/Helper/Csv.pm @@ -3,6 +3,7 @@ package SL::Helper::Csv; use strict; use warnings; +use version 0.77; use Carp; use IO::File; use Params::Validate qw(:all); @@ -156,11 +157,19 @@ sub _parse_data { push @data, \%hr; } else { last if $self->_csv->eof; - push @errors, [ - $self->_csv->error_input, - $self->_csv->error_diag, - $self->_io->input_line_number, - ]; + # Text::CSV_XS 0.89 added record number to error_diag + if (qv(Text::CSV_XS->VERSION) >= qv('0.89')) { + push @errors, [ + $self->_csv->error_input, + $self->_csv->error_diag, + ]; + } else { + push @errors, [ + $self->_csv->error_input, + $self->_csv->error_diag, + $self->_io->input_line_number, + ]; + } } last if $self->_csv->eof; } @@ -271,7 +280,7 @@ it. You provide valid header columns and their mapping to the objects. =item You do NOT know if the csv provider yields to your expectations. Stuff that does not work with what you expect should not crash anything, but -give you a hint what went wrong. As a result, if you remeber to check for +give you a hint what went wrong. As a result, if you remember to check for errors after each step, you should be fine. =item Data does not make sense. It's just data.