On Tue, 30 Jun 2009 14:37:24 -0400, "Evan Carroll via RT"
<bug-Text-CSV_XS@rt.cpan.org> wrote:
Show quoted text> Well it is ambiguous either way.. But, for perl, using the MooseX::Types
> I'd rather it be "undefined" than defined as an empty string (even
> though it is literally what it is, it is part of the CSV-exportation
> process). Actually, I can't think of any practical case where you would
> want to send an empty string in a csv file anyway,
Oh, but I do, and use it day-in-day-out. When *exporting* databases to
CSV, ,"", is an empty string, and ,, is a NULL value when using
{ quote_always => 1 } I see no other way to do that.
Show quoted text> and not want the receiving end to correct it as NULL. Maybe something
> like this is called for:
>
> naked_quotes_are_undef => 1
in my perception that would be
empty_is_undef => 1,
but where is the reading function? How hard would it be to
while (my $row = getline ($fh)) {
my @row = @$row;
to
while (my $row = getline ($fh)) {
my @row = map { $_ eq "" ? undef : $_ } @$row;
Show quoted text> Then I can say
> has 'price_term' => ( isa => 'Maybe[Int]', is => rw );
>
> and do $self->price_term (value from $csv->fields)
--
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/