On Sun, 13 Dec 2009 07:10:31 -0500, "YKAR via RT"
<bug-Text-CSV_XS@rt.cpan.org> wrote:
Show quoted text> Queue: Text-CSV_XS
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=50911 >
>
> Thank you for taking into account my suggestion.
>
> quote_space, works not very well. If string has any leading or trailing
> spaces, they will be lost, because CSV parser strip any white space from
> the beginning and from the end of the string. So it is safe not to quote
> string only if string does not have leading or trailing spaces.
$ perl -MText::CSV_XS -wle'Text::CSV_XS->new({quote_space=>0})->print(*STDOUT,["x"," x","x ","x x"," x x ",1])'
x, x,x ,x x, x x ,1
$ perl -MText::CSV_XS -wle'Text::CSV_XS->new({quote_space=>1})->print(*STDOUT,["x"," x","x ","x x"," x x ",1])'
x," x","x ","x x"," x x ",1
Works exactly as documented IMHO.
If leading or trailing spaces are lost by the parser, blame the parser,
not the generator
--
H.Merijn Brand
http://tux.nl Perl Monger
http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/