Taxi(3)
π Taxi(3) β the manual page, but make it make sense
okay so bestie, this is the manual page for Data::Taxi, and it's part of the User Contributed Perl Documentation (which is the fancy way of saying "a real one in the Perl community wrote this, not the core team"). Buckle up, we're learning about taint-aware XML-ish data serialization π
β¨ NAME β¨
Data::Taxi β Taint-aware, XML-ish data serialization π
PLEASE NOTE: Data::Taxi is no longer being developed or supported. Not me delivering the bad news first thing π but yeah. It's done. It's retired. It's living its best retired life.
πΈ SYNOPSIS πΈ
use Data::Taxi ':all';
my ($ob, $str);
$ob = MyClass->new();
$str = freeze($ob);
$ob = thaw($str);
that's the whole vibe honestly. freeze it, thaw it, periodt π§β‘οΈπ§
π οΈ INSTALLATION π οΈ
The classic, iconic, no-notes installation routine β literally the usual:
perl Makefile.PL
make
make test
make install
and if you're feeling extra lowkey about it? You can also just copy Taxi.pm straight into the Data/ directory of one of your library trees. that's it. that's the whole install. so easy it's giving "why is everything else so hard" π
π DESCRIPTION π
Taxi (short for Taint-Aware XML-Ish, ikyk) is a data serializer with several handy features, and honestly? the features ate:
Taint aware Taxi does not force you to trust the data you are serializing. None of the input data is executed. ever. so you can stop clutching your pearls π«Ά
Human readable Taxi produces a human-readable string that simplifies checking the output of your objects. literally you can just look at it with your eyeballs π
XML-ish While the author doesn't (currently) promise full XML compliance, Taxi produces a block of XML-ish data that could probably be read in by other XML parsers. "probably" is doing a lot of heavy lifting there but we respect the honesty β
π¦ EXPORT π¦
None by default. You get freeze and thaw with ':all':
use Data::Taxi ':all';
that's the whole shortcut. you're welcome π
π Subroutines π
βοΈ freeze($ob, %opts) βοΈ
freeze serializes a single scalar, hash reference, array reference, or scalar reference into an XML string. and like, freeze can recurse any number of levels of a nested tree and preserve multiple references to the same object. she's versatile, she's thorough, she's iconic π
Let's look at an example, because the example is honestly the moment:
my ($tree, $format, $members, $bool, $mysca);
# anonymous hash
$format = {
'app'=>'trini',
'ver'=>'0.9',
'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'=>'miko@idocs.com', };
# the whole thing
$tree = {
'dataformat' => $format,
'otherdataformat' => $format,
'bool' => $bool,
'members' => $members,
'myscaref' => \$mysca,
};
$frozen = freeze($tree);
(and yes, $format has 'ver' listed twice β that's in the original, we do not fix, we do not touch, we simply observe π)
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 &amp; that"/>
<scalar name="app" value="trini"/>
</hashref>
<scalarref name="myscaref" id="2">
<hashref id="3">
<scalar name="email" value="miko@idocs.com"/>
<scalar name="name" value="miko"/>
</hashref>
</scalarref>
<hashref name="bool" id="4" class="Math::BooleanEval">
<hashref name="blanks" id="5">
</hashref>
<scalar name="pos" value="0"/>
<arrayref name="arr" id="6">
<scalar value="whatever"/>
</arrayref>
<scalar name="expr" value="whatever"/>
</hashref>
<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"/>
</arrayref>
</hashref>
</taxi>
notice how otherdataformat and dataformat both point at id="1" and the second one is flagged redundant="1"? that's the shared-reference magic bestie, she remembers π₯
π thaw π
thaw accepts one argument β the serialized data string β and returns a single value, the reconstituted data, rebuilding the entire data structure including blessed references. it's giving resurrection, it's giving revival, it's giving "she's back and better" π
$tree = thaw($frozen);
π§ IS TAXI DATA XML? π§
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. that's the deal, that's the contract, take it or leave it π€
The reason the author didn't go for full XML compliance is that he 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. periodt π
If you want to help make Taxi fully XML compliant w/o making it bloated, that's cool β drop him an email and you can work together π«Ά
π TODO π
Tied scalars don't work. The code started getting spaghettish trying to implement them, so he decided to use the Asimov method and stop thinking about it for a while ππ
Tied hashes and arrays should work fine. should. should. we love a confident "should" π
βοΈ TERMS AND CONDITIONS βοΈ
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. like, none. zero. not a crumb. π«
π AUTHOR π
Miko O'Sullivan miko@idocs.com β the main character who built this whole thing π
ποΈ VERSION ποΈ
- Version 0.90 β June 15, 2002 β initial public release π
- Version 0.91 β July 10, 2002 β minor improvment to documentation (their spelling, not mine, we keep it fr fr) βοΈ
- Version 0.94 β April 26, 2003 β Fixed problem handling undefined scalars. π
- Version 0.95 β Oct 31, 2008 β Adding notice of last release. spooky timing π
- Version 0.96 β Nov 14, 2010 β Fixing bug: (and then... nothing. the sentence just ends. we may never know what the bug was π)
π POD ERRORS π
Hey! The above document had some coding errors, which are explained below:
Around line 684:
=end CPAN without matching =begin. (Stack: [empty])
ngl that's iconic. the documentation has a documentation error and the manual page just... reports it. self-aware king π
πΈ okay bestie, that's the whole page! this was perl v5.32.1, dated 2021-07-22, and that's the Taxi(3) manual page signing off β go freeze something and thaw it back out, you've got this π«Άπβ¨
π¦ where this page comes from
- epel 9: perl-Data-Taxi 0.96-31.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms