Subject: | Text::CSV::Encode issues warning on empty values |
Hi,
Text::CSV::Encoded::Coder::Encode throws warnings when one tries to
process datasets with empty values. I'd assume that empty (NULL) values
are valid values when used in CSV files and therefore, also using
Text-CSV-Encoded should not throw an exception.
I have fixed this for me by encapsulating the relevant 'encode' function
into an 'if ($_) {...}' block.
=> I have replaced procedure "encode_fields_ref' by
sub encode_fields_ref {
my ( $self, $encoding, $arrayref ) = @_;
my $enc = $self->find_encoding($encoding) || return;
for (@$arrayref) {
if ($_) {
$_ = $enc->encode($_);
}
}
}
I think this could be fixed in general for the next release. :-)
Cheers,
Thomas
PS: Thanks for this module, saved me lot of work.