NAME
Pixie - The magic data pixie
SYNOPSIS
use Pixie;
my $pixie = Pixie->new->connect('dbi:mysql:dbname=test', $user, $pass);
# Save an object
my $cookie = $pixie->insert($some_object);
undef($some_object);
# Get it back
my $some_object = $pixie->get($cookie);
DESCRIPTION
Pixie is yet another object persistence tool. The basic goal of Pixie is that it should be possible to throw any object you want at a data pixie and the pixie will just tuck it away in its magic sack, giving you a cookie in exchange. Then, minutes, hours or days later, you can show the pixie your cookie and get the object back.
No schemas. No complex querying. No refusing to handle blessed arrays.
How does pixie do this? Well... when we said 'any object' we were being slightly disingenuous. As far as Pixie is concerned 'any object' means 'any object that satisfies any of these criteria':
The toplevel object is a blessed hash.
The toplevel object is a blessed array and
$object->can('_oid')
(it is a good idea if the _oid returned is unique, for appropriate values of 'unique'.
Once you get below the toplevel of a composed object there is no longer a requirment for classes that are represented by blessed arrays to implement the _oid
method (though if you do not implement _oid
) you will almost certainly find that multiple objects that point to the same blessed array will no longer do so after they have been saved and restored. Which may not be what you want...
Right now, Pixie can only save blessed hashes and blessed arrays, but it should be possible to extend it to support 'bless arbitrary scalars'. However, during testing we found that blessed arbitrary scalars were often used with XS classes that stored extra data where Storable and Data::Dumper could not see it, leading to all sorts of horrors on restoration. So we turned that feature off pending a better approach.
AUTHOR
Pixie sprang from the mind of James Duncan, james@fotango.com. Piers Cawley, pdcawley@bofh.org.uk and Leon Brocard, acme@astray.org are his co conspiritors.