From: Sven Dowideit <[email protected]>
---
AnyData.pm | 2 +-
Changes | 2 +-
t/api.t | 27 +++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
create mode 100644 t/api.t
diff --git a/AnyData.pm b/AnyData.pm
index dd350c7..1b34d2d 100644
--- a/AnyData.pm
+++ b/AnyData.pm
@@ -488,7 +488,7 @@ sub adDump {
my @cols = @{ $ad->col_names };
print "<",join(":", @cols), ">\n";
while (my $row = each %$table) {
- my @row = map {$row->{$_} || ''} @cols;
+ my @row = map {defined $row->{$_} ? $row->{$_} : ''} @cols;
for (@row) { print "[$_]"; }
print "\n";
}
diff --git a/Changes b/Changes
index e09929f..6c651c8 100644
--- a/Changes
+++ b/Changes
@@ -12,7 +12,7 @@ version 0.11, released Aug 2012
* adColumn $distinct_flag not handled (RT#6248 & RT#6251) John D. Lima
* writing fields containing 0 with AnyData::Format::Fixed (RT#8671)
<elodie+cpan [...] pasteur.fr>
* weblog request and referer regexs were too greedy, and the referer and
client regex's where in the wrong order (RT#34063) and (RT#72334) Wes Brown
<wes [...] smellycat.com> and pawal [...] blipp.com
- *
+ * adDump writes out fields containing 0 as empty strings (RT#28006) xcaron
[...] gmail.com
version 0.10, released 19 April 2004
diff --git a/t/api.t b/t/api.t
new file mode 100644
index 0000000..9c743b2
--- /dev/null
+++ b/t/api.t
@@ -0,0 +1,27 @@
+#!/usr/local/bin/perl -wT
+use strict;
+use warnings;
+
+use Test::More;
+plan tests => 2;
+use Test::Output;
+
+
+use AnyData;
+
+my $table = adTie( 'CSV',
["word,number\none,1\ntwo,2\nthree,3\nunknown\nunknowncomma,\nzero,0"] );
+
+ok( 6 == adRows($table), "Failed rows" );
+
+stdout_is( sub {adDump( $table )}, <<'HERE', 'export fixed format' );
+<word:number>
+[one][1]
+[two][2]
+[three][3]
+[unknown][]
+[unknowncomma][]
+[zero][0]
+HERE
+
+
+__END__
--
1.7.10.4