From: Sven Dowideit <svendowid...@fosiki.com>

---
 AnyData/Format/XML.pm |    6 ++----
 Changes               |    1 +
 MANIFEST.SKIP         |   27 +++++++++++++++++++++++++++
 t/htmltable.t         |   31 +++++++++++++++++++++++++++++++
 t/xml.t               |   31 +++++++++++++++++++++++++++++++
 5 files changed, 92 insertions(+), 4 deletions(-)
 create mode 100644 MANIFEST.SKIP
 create mode 100644 t/htmltable.t
 create mode 100644 t/xml.t

diff --git a/AnyData/Format/XML.pm b/AnyData/Format/XML.pm
index fd86c39..1014c38 100644
--- a/AnyData/Format/XML.pm
+++ b/AnyData/Format/XML.pm
@@ -867,11 +867,9 @@ sub export {
 #z  my $format = shift;
     my $file = shift;
     my $flags = shift || {};
-#print "\n\n== $file == \n\n" if $file;
 #$self->{twig}->print;
-#z    if ( ( $storage and $file and !($file eq $storage->{file_name}) )
-#z      or ( $storage and $file and !$storage->{fh} )
-    if ( ( $storage and $file )
+    if ( 
+      ( $storage and $file and !$storage->{fh} )
        ) {
        $storage->{file_name} = $file;
        $storage->{fh} = $storage->open_local_file($file,'o');
diff --git a/Changes b/Changes
index 6c651c8..5f50a15 100644
--- a/Changes
+++ b/Changes
@@ -13,6 +13,7 @@ version 0.11, released  Aug 2012
  * 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
+ * A bug in AnyData::Format::Weblog, SQL excuting result is not correct 
(RT#56962) young...@gmail.com
 
 version 0.10, released 19 April 2004
 
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644
index 0000000..ff3da45
--- /dev/null
+++ b/MANIFEST.SKIP
@@ -0,0 +1,27 @@
+\B\.svn\b
+\.[Bb][Aa][Kk]$
+\.orig$
+\.old$
+\.tdy$
+\.tmp$
+\..*swp
+^Makefile$
+^Build$
+CVS/.*
+\.svn/.*
+\.cvsignore$
+\.Inline/.*
+_Inline/.*
+\.bak$
+\.tar$
+\.tgz$
+\.tar\.gz$
+^mess/
+^tmp/
+^testdata/
+^blib/
+^pm_to_blib$
+^_build/.*
+~$
+^MYMETA.yml$
+DBD-AnyData-.*
diff --git a/t/htmltable.t b/t/htmltable.t
new file mode 100644
index 0000000..83f6a58
--- /dev/null
+++ b/t/htmltable.t
@@ -0,0 +1,31 @@
+#!/usr/local/bin/perl -w
+use strict;
+use warnings;
+
+use Test::More;
+plan tests => 3;
+
+use AnyData;
+
+my $table =
+  adTie( 'CSV',
+    ["word,number\none,1\ntwo,2\nthree,3\nunknown\nunknowncomma,\nzero,0"] );
+
+ok( 6 == adRows($table), "Failed rows" );
+
+adExport( $table, "HTMLtable", 't/htmltable.out' );
+ok( open( my $fh, '<', 't/htmltable.out' ), 'open file' );
+local $\ = '';
+my $result = <$fh>;
+
+#print STDERR "\n---\n";
+#print STDERR "$result";
+#print STDERR "\n---\n";
+
+ok(
+    $result eq
+'<table>t/htmltable.out <tr bgcolor="#c0c0c0"><th>word</th> 
<th>number</th></tr> <tr><td>one</td> <td>1</td></tr> <tr><td>two</td> 
<td>2</td></tr> <tr><td>three</td> <td>3</td></tr> <tr><td>unknown</td></tr> 
<tr><td>unknowncomma</td> <td>&nbsp;</td></tr> <tr><td>zero</td> 
<td>&nbsp;</td></tr></table>',
+    'xml export ok'
+);
+
+__END__
diff --git a/t/xml.t b/t/xml.t
new file mode 100644
index 0000000..a0ee2fc
--- /dev/null
+++ b/t/xml.t
@@ -0,0 +1,31 @@
+#!/usr/local/bin/perl -w
+use strict;
+use warnings;
+
+use Test::More;
+plan tests => 3;
+
+use AnyData;
+
+my $table =
+  adTie( 'CSV',
+    ["word,number\none,1\ntwo,2\nthree,3\nunknown\nunknowncomma,\nzero,0"] );
+
+ok( 6 == adRows($table), "Failed rows" );
+
+adExport( $table, "XML", 't/xml.out' );
+ok( open( my $fh, '<', 't/xml.out' ), 'open file' );
+local $\ = '';
+my $result = <$fh>;
+
+#print STDERR "\n---\n";
+#print STDERR "$result";
+#print STDERR "\n---\n";
+
+ok(
+    $result eq
+'<table><row><word>one</word><number>1</number></row><row><word>two</word><number>2</number></row><row><word>three</word><number>3</number></row><row><word>unknown</word></row><row><word>unknowncomma</word></row><row><word>zero</word><number>0</number></row></table>',
+    'xml export ok'
+);
+
+__END__
-- 
1.7.10.4

Reply via email to