Joshua ben Jore wrote:
Didn't you just reinvent Text::CSV_XS? The only tweak required is
saying "binary" to enable the use of newlines inside quoted fields.

->new({
    binary => 1,

    # defaults
    eol => qq(\r\n),
    sep_char => q(,),
    quote_char => q("),
    escape_char => q("),
})

Josh
It appears I shoulda spent more time reading the man pages. A loop like this:

while(my $d = $obj->get_chunk) {
   my $dh = new IO::Scalar \$d;
   while(my $f = $csv->getline($dh) and @$f) {
      process_fields($f);
   }
}

works just fine, as long as the $csv object is constructed with the "binary => 1" option. I'm not sure what would happen in the case where the data is in pieces that don't correspond to CSV line boundaries, but fortunately for me, my application can guarantee getting the data in complete records. So, looks like CSV::Parse is going away.

Thanks, Josh!

Reply via email to