Subject: | No option to only quote empty but not undef fields |
Date: | Mon, 16 Apr 2012 11:14:20 -0700 |
To: | bug-Text-CSV [...] rt.cpan.org |
From: | Tim Howe <timh [...] dirtymonday.net> |
It would be nice if there were some way to only quote empty fields when
they aren't undef.
For example, if I don't have always_quote defined, some output might
look like this:
"Column One","Column 2",dog,cat,
However, the 5th column might be undef, or it could just be an empty
string. I would suggest that when blank_is_undef is set, empty fields
get quoted like so:
"Column One","Column 2",dog,cat,""
this way we know it is an empty string and not undef. undef in column
5 would look like:
"Column One","Column 2",dog,cat,
The only way I have found to differentiate empty strings from undef in
output is to set always_quote and blank_is_undef, but the output then
looks like this if the 5th column is undef:
"Column One","Column 2","dog","cat",
and like this if it is an empty string:
"Column One","Column 2","dog","cat",""
This "works", but it isn't how I would choose to do this.
--TimH