Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Text::CSV_XS -- Bug or wrong usage?

by jmcnamara (Monsignor)
on Mar 27, 2003 at 17:02 UTC ( [id://246291]=note: print w/replies, xml ) Need Help??


in reply to Text::CSV_XS -- Bug or wrong usage?


This definitely looks like a bug.

You should report it but in the meantime you can workaround it by omitting the escape character and doing your own escaping. The following example replaces "\:" with $; (char 032) before parsing and then converts it back:

#!/usr/bin/perl -wl use strict; use Text::CSV_XS; my $row = '0005:A:A2:\\\\string 04\\\\'; # Translate escaped : "\:" $row =~ s/\\:/$;/eg; my $csv = Text::CSV_XS->new({'quote_char' => '', 'escape_char' => '', 'sep_char' => ':', 'binary' => 1 }); if ($csv->parse($row)) { my @fields = $csv->fields(); # Replace escaped chars s/$;/\\:/g for @fields; print "$fields[3]\n"; } else { print "Parse failed ", $csv->error_input(); }

--
John.

Replies are listed 'Best First'.
Re: Re: Text::CSV_XS -- Bug or wrong usage?
by choeppner (Pilgrim) on Mar 28, 2003 at 16:01 UTC
    Thanks for the suggestion.

    I have sent an email to the listed author.

    The author has indicated that the modules current maintainer is Jeff Zucker, jzucker@cpan.org.

    Charles
    (The quiet Monk)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246291]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-24 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found