Subject: | Is bind_columns broken or am I using it wrong? |
Hello,
I've been trying to "optimize" our CSV parser to see if I can speed it
up and noticed the bind_columns method. I thought it would be the best
method to use, and stumbled on this error/warning. The file parses OK if
I use the "normal" way without bind_columns, but never works if I try it.
I thought the utf8 text might be causing issues, but using the file
sanitized of all utf8 characters doesn't work either. Folks on IRC tried
to help me debug this, and we agreed that it probably is a bug OR we are
obviously using it wrong.
I hope you can look at this and let me know if it's a bug or I'm simply
using bind_columns wrong. If I'm using it wrong, I would be happy to
help you redocument the POD to get it "right", ha!
Attached is the perl code + test CSV file. This didn't work on 5.8.8 or
5.10.0 on linux.
Thanks again!
--
~Apocalypse
Subject: | logparser.pl |
#!/usr/bin/perl
use strict; use warnings;
use Text::CSV_XS;
#use utf8; # no difference
my $csv = Text::CSV_XS->new({ binary => 1 });
#open my $fh, "<:utf8", "log.txt" or die "unable to open: $!"; # no difference
open my $fh, "<", "log.txt" or die "unable to open: $!";
my( $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10 );
my @columns = \( $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10 );
$csv->bind_columns( \$c0, \$c1, \$c2, \$c3, \$c4, \$c5, \$c6, \$c7, \$c8, \$c9, \$c10 );
#$csv->bind_columns( \( $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10 ) ); # no difference
#$csv->bind_columns( @columns ); # no difference
while ( my $row = $csv->getline( $fh ) ) {
# got the line
print "got row: $c0 - $c1 - $c2\n";
}
close $fh or die "unable to close: $!";
Subject: | log.txt |
SPELL_AURA_APPLIED,0x00000000019BED4E,"Snêêfly",0x514,0x0000000001751ED6,"Fibe",0x511,32223,"Aura des Kreuzfahrers",0x2,BUFF
SPELL_AURA_APPLIED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,47982,"Blutpakt",0x20,BUFF
SPELL_AURA_APPLIED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,35696,"Dämonisches Wissen",0x1,BUFF
SPELL_AURA_APPLIED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,23829,"Meister der Dämonologie",0x20,BUFF
SPELL_AURA_REMOVED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,35696,"Dämonisches Wissen",0x1,BUFF
SPELL_AURA_APPLIED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,35696,"Dämonisches Wissen",0x1,BUFF
SPELL_AURA_REMOVED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,23829,"Meister der Dämonologie",0x20,BUFF
SPELL_AURA_APPLIED,0xF14052A693000017,"Chotuk",0x1114,0x0000000001DECBE8,"Cooly",0x514,23829,"Meister der Dämonologie",0x20,BUFF
SWING_DAMAGE,0xF1300042660041E1,"Mr. Bigglesworth",0xa28,0xF130003E9E00442C,"Made",0xa28,6,0,1,0,0,0,nil,nil,nil
SPELL_AURA_APPLIED,0x00000000019BED4E,"Snêêfly",0x514,0x0000000001DECBE8,"Cooly",0x514,32223,"Aura des Kreuzfahrers",0x2,BUFF