Mysql - Select To XML
It appears this has already been answered here.

The answer references this article.

From the answer:


  From the article:

use strict;
use DBI;
use XML::Generator::DBI;
use XML::Handler::YAWriter;

my $dbh = DBI-&gt;connect ("DBI:mysql:test",
                       "testuser", "testpass",
                       { RaiseError =&gt; 1, PrintError =&gt; 0});
my $out = XML::Handler::YAWriter-&gt;new (AsFile =&gt; "-");
my $gen = XML::Generator::DBI-&gt;new (
                               Handler =&gt; $out,
                               dbh =&gt; $dbh
                           );
$gen-&gt;execute ("SELECT name, category FROM animal");
$dbh-&gt;disconnect ();