JOINs get scrambled when the tables involved have rows with empty (NULL)
trailing values. It's because those values are simply missing - there
are no commas. I noticed the discussion of the treatment of NULLs in
the POD for DBD::CSV, but I still found this unexpected.
Attached is a test program that demonstrates the problem, and sample
output from it.
Here's a one-line fix, that is backward compatible (does not add
commas to the files), and passes the module's tests:
--- CSV.pm.orig 2005-03-31 17:50:15.000000000 -0500
+++ CSV.pm 2009-01-29 15:49:53.000000000 -0500
@@ -210,6 +210,7 @@
die "Error while reading file " . $self->{'file'} . ": $!"
if $!;
return undef;
}
+ push @$fields, undef while @$fields < @{$self->{col_names}};
}
$self->{row} = (@$fields ? $fields : undef);
}
It just pads the response with undef's when the array is too short.
John