1Taxi(3)               User Contributed Perl Documentation              Taxi(3)
2
3
4

NAME

6       Data::Taxi - Taint-aware, XML-ish data serialization
7
8       PLEASE NOTE: Data::Taxi is no longer being developed or supported.
9

SYNOPSIS

11         use Data::Taxi ':all';
12         my ($ob, $str);
13
14         $ob = MyClass->new();
15         $str = freeze($ob);
16         $ob = thaw($str);
17

INSTALLATION

19       Data::Taxi can be installed with the usual routine:
20
21               perl Makefile.PL
22               make
23               make test
24               make install
25
26       You can also just copy Taxi.pm into the Data/ directory of one of your
27       library trees.
28

DESCRIPTION

30       Taxi (Taint-Aware XML-Ish) is a data serializer with several handy
31       features:
32
33       Taint aware
34           Taxi does not force you to trust the data you are serializing.
35           None of the input data is executed.
36
37       Human readable
38           Taxi produces a human-readable string that simplifies checking the
39           output of your objects.
40
41       XML-ish
42           While I don't (currently) promise full XML compliance, Taxi
43           produces a block of XML-ish data that could probably be read in by
44           other XML parsers.
45

EXPORT

47       None by default.  freeze and thaw with ':all':
48
49          use Data::Taxi ':all';
50

Subroutines

52   freeze($ob, %opts)
53       "freeze" serializes a single scalar, hash reference, array reference,
54       or scalar reference into an XML string, "freeze" can recurse any number
55       of levels of a nested tree and preserve multiple references to the same
56       object.  Let's look at an example:
57
58               my ($tree, $format, $members, $bool, $mysca);
59
60               # anonymous hash
61               $format = {
62                       'app'=>'trini',
63                       'ver'=>'0.9',
64                       'ver'=>'this & that',
65               };
66
67               # anonymous array
68               $members = ['Starflower', 'Mary', 'Paul', 'Hallie', 'Ryan'];
69
70               # blessed object
71               $bool = Math::BooleanEval->new('whatever');
72
73               # scalar reference (to an anonymous hash, no less)
74               $mysca = {'name'=>'miko', 'email'=>'miko@idocs.com', };
75
76               # the whole thing
77               $tree = {
78                       'dataformat' => $format,
79                       'otherdataformat' => $format,
80                       'bool' => $bool,
81                       'members' => $members,
82                       'myscaref' => \$mysca,
83               };
84
85               $frozen = freeze($tree);
86
87       "freeze" accepts one object as input.  The code above results in the
88       following XML-ish string:
89
90          <taxi ver="1.00">
91             <hashref id="0">
92                <hashref name="otherdataformat" id="1">
93                   <scalar name="ver" value="this &#38;amp; that"/>
94                   <scalar name="app" value="trini"/>
95                </hashref>
96                <scalarref name="myscaref" id="2">
97                   <hashref id="3">
98                      <scalar name="email" value="miko@idocs.com"/>
99                      <scalar name="name" value="miko"/>
100                   </hashref>
101                </scalarref>
102                <hashref name="bool" id="4" class="Math::BooleanEval">
103                   <hashref name="blanks" id="5">
104                   </hashref>
105                   <scalar name="pos" value="0"/>
106                   <arrayref name="arr" id="6">
107                      <scalar value="whatever"/>
108                   </arrayref>
109                   <scalar name="expr" value="whatever"/>
110                </hashref>
111                <hashref name="dataformat" id="1" redundant="1"/>
112                <arrayref name="members" id="7">
113                   <scalar value="Starflower"/>
114                   <scalar value="Mary"/>
115                   <scalar value="Paul"/>
116                   <scalar value="Hallie"/>
117                   <scalar value="Ryan"/>
118                </arrayref>
119             </hashref>
120          </taxi>
121
122   thaw
123       "thaw" accepts one argument, the serialized data string, and returns a
124       single value, the reconstituted data, rebuilding the entire data
125       structure including blessed references.
126
127          $tree = thaw($frozen);
128

IS TAXI DATA XML?

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

TODO

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

TERMS AND CONDITIONS

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

AUTHOR

151       Miko O'Sullivan miko@idocs.com
152

VERSION

154        Version 0.90    June 15, 2002
155        initial public release
156
157        Version 0.91    July 10, 2002
158        minor improvment to documentation
159
160        Version 0.94    April 26, 2003
161        Fixed problem handling undefined scalars.
162
163        Version 0.95    Oct 31, 2008
164        Adding notice of last release
165
166        Version 0.96    Nov 14, 2010
167        Fixing bug:
168

POD ERRORS

170       Hey! The above document had some coding errors, which are explained
171       below:
172
173       Around line 684:
174           =end CPAN without matching =begin.  (Stack: [empty])
175
176
177
178perl v5.30.0                      2019-07-26                           Taxi(3)
Impressum