Subject: | Using getline() after bind_columns() returns undef even though data exists |
Date: | Wed, 25 Sep 2019 15:59:36 -0500 |
To: | bug-Text-CSV_XS [...] rt.cpan.org |
From: | "Mickey M." <m.mokotov [...] gmail.com> |
Hi,
We use Text-CSV::XS for a while and it's awesome. Recently we encounter a
weird behavior. Using getline() after bind_columns() returns undef for
specific parsed data. We isolated the case to something reproducible, here
it is:
*Env:*
$ sudo cpanm Text::CSV_XS
Text::CSV_XS is up to date. (1.40)
$ perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for
x86_64-linux-thread-multi
*Code:*
my $row = {};
my $reader = new Text::CSV_XS( { binary => 1, sep_char => "|" } );
$reader->bind_columns( \@{ $row }{ qw( a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11
a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30
a31 a32 a33 a34 a35 a36 a37 a38 a39 ) } );
use Data::Dumper;
print Dumper( $reader->getline( *STDIN ) );
print Dumper( $row );
*Data (note the " on val10):*
val1|val2|val3|val4|val5|val6|val7|val8|val9|val10"|val11|val12|val13|val14|val15|val16|val17|val18|val19|val20|val21|val22|val23|val24|val25|val26|val27|val28|val29|val30|val31|val32|val33|val34|val35|val36|val37|val38|val39
Thanks,
Mickey.