Pixie - The magic data pixie
use Pixie; my $pixie = Pixie->new->connect('dbi:mysql:dbname=test', user => $user, pass => $pass); # Save an object my $cookie = $pixie->insert($some_object); undef($some_object); # Get it back my $some_object = $pixie->get($cookie); $pixie->bind_name( "Some Name" => $some_object ); my $result = $pixie->get_object_named( "Some Name" );
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 inserted object is a blessed hash.
The inserted object is a blessed array
The inserted object is 'complicit' with Pixie, see Pixie::Complicity
You'll note that we don't include 'blessed arbitrary scalars' in this list. This is because, during testing we found that the majority of objects that are represented as blessed scalars are often using XS to store extra data that Storable and Data::Dumper can't see, which leads to all sorts of problems later. So, if you use a blessed scalar as your object representation then you'll have to use the complicity features. Sorry.
Pixie can additionally be used to name objects in the store, and fetch them later on with that name.
Pixie::Complicity -- Sometimes Pixie can't make an object persistent without help from the object's class. In that case you need to make the class 'complicit' with Pixie. You'll typically need to do this with XS based classes that use a simple scalar as their perl visible object representation, or with closure based classes.
Pixie::FinalMethods -- There are some methods that Pixie requires to behave in a particular way, not subject to the vagaries of overloading. One option would be to write a bunch of private subroutines and methods within Pixie, but very often it makes sense to move the behaviour onto the objects being stored. Pixie::FinalMethods describes how we achieve this.
Pixie::Store is the abstract interface to physical storage. If you want to write a new backend for pixie, start here.
Jean Louis Leroy, author of Tangram, for letting us use ideas and code from the Tangram test suite.
Pixie sprang from the mind of James Duncan <email@example.com>. Piers Cawley <firstname.lastname@example.org> and Leon Brocard <email@example.com> are his co conspiritors.
Copyright 2002 Fotango Ltd
This software is released under the same license as Perl itself.