The following wouldn't be through DBI (or Perl for that matter), but what about backing the database up using mysqldump ? While it is through the commandline, it's dumps out the contents of the db to SQL statements quite nicely.
Very strange. One might even say icky. Then I guess the best bet is to dump it out the way you're trying.