Data::Taxi - Taint-aware, XML-ish data serialization

PLEASE NOTE: Data::Taxi is no longer being developed or supported.


  use Data::Taxi ':all';
  my ($ob, $str);
  $ob = MyClass->new();
  $str = freeze($ob);
  $ob = thaw($str);


Data::Taxi can be installed with the usual routine:

        perl Makefile.PL
        make test
        make install

You can also just copy into the Data/ directory of one of your library trees.


Taxi (Taint-Aware XML-Ish) is a data serializer with several handy features:

Taint aware

Taxi does not force you to trust the data you are serializing. None of the input data is executed.

Human readable

Taxi produces a human-readable string that simplifies checking the output of your objects.


While I don't (currently) promise full XML compliance, Taxi produces a block of XML-ish data that could probably be read in by other XML parsers.


None by default. freeze and thaw with ':all':

   use Data::Taxi ':all';


freeze($ob, %opts)

freeze serializes a single scalar, hash reference, array reference, or scalar reference into an XML string, freeze can recurse any number of levels of a nested tree and preserve multiple references to the same object. Let's look at an example:

        my ($tree, $format, $members, $bool, $mysca);
        # anonymous hash
        $format = {
                'ver'=>'this & that',
        # anonymous array
        $members = ['Starflower', 'Mary', 'Paul', 'Hallie', 'Ryan'];
        # blessed object
        $bool = Math::BooleanEval->new('whatever');
        # scalar reference (to an anonymous hash, no less)
        $mysca = {'name'=>'miko', 'email'=>'', };
        # the whole thing
        $tree = {
                'dataformat' => $format,
                'otherdataformat' => $format,
                'bool' => $bool,
                'members' => $members,
                'myscaref' => \$mysca,
        $frozen = freeze($tree);

freeze accepts one object as input. The code above results in the following XML-ish string:

   <taxi ver="1.00">
      <hashref id="0">
         <hashref name="otherdataformat" id="1">
            <scalar name="ver" value="this &#38;amp; that"/>
            <scalar name="app" value="trini"/>
         <scalarref name="myscaref" id="2">
            <hashref id="3">
               <scalar name="email" value=""/>
               <scalar name="name" value="miko"/>
         <hashref name="bool" id="4" class="Math::BooleanEval">
            <hashref name="blanks" id="5">
            <scalar name="pos" value="0"/>
            <arrayref name="arr" id="6">
               <scalar value="whatever"/>
            <scalar name="expr" value="whatever"/>
         <hashref name="dataformat" id="1" redundant="1"/>
         <arrayref name="members" id="7">
            <scalar value="Starflower"/>
            <scalar value="Mary"/>
            <scalar value="Paul"/>
            <scalar value="Hallie"/>
            <scalar value="Ryan"/>


thaw accepts one argument, the serialized data string, and returns a single value, the reconstituted data, rebuilding the entire data structure including blessed references.

   $tree = thaw($frozen);


Although Taxi's data format is XML-ish, it's not fully compliant to XML in all regards. For now, Taxi only promises that it can input its own output. The reason I didn't go for full XML compliance is that I wanted to keep Taxi as light as possible while achieving its main goal in life: pure-perl serialization. XML compliance is not part of that goal. If you want to help make Taxi fully XML compliant w/o making it bloated, that's cool, drop me an email and we can work together.


Tied scalars don't work. The code started getting spaghettish trying to implement them, so I decided to use the Asimov method and stop thinking about it for a while. Tied hashes and arrays should work fine.


Copyright (c) 2002 by Miko O'Sullivan. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This software comes with NO WARRANTY of any kind.


Miko O'Sullivan


 Version 0.90    June 15, 2002
 initial public release

 Version 0.91    July 10, 2002
 minor improvment to documentation

 Version 0.94    April 26, 2003
 Fixed problem handling undefined scalars.

 Version 0.95    Oct 31, 2008
 Adding notice of last release

 Version 0.96    Nov 14, 2010
 Fixing bug:

1 POD Error

The following errors were encountered while parsing the POD:

Around line 685:

=end CPAN without matching =begin. (Stack: [empty])