Subject: | Problem with parsing |
Hi,
I found bug in parsing. See bug_simulation.pl script.
Regards,
Michal Špaček
Subject: | bug_simulation.pl |
#!/usr/bin/env perl
# Pragmas.
use strict;
use warnings;
# Modules.
use English;
use IO::Barf qw(barf);
use File::Temp qw(tempfile);
use Text::CSV::Field;
# Data.
my $data = <<'END';
Foo,Bar
1,2
3,4
END
# Save to temp file.
my (undef, $tempfile) = tempfile();
barf($tempfile, $data);
# Object.
my $obj = Text::CSV::Field->new($tempfile, ',');
# Get field.
eval {
$obj->getfield('Foo');
};
if ($EVAL_ERROR) {
print "ERROR: $EVAL_ERROR\n";
}
# Clean.
unlink $tempfile;