in reply to Using bytecode for object serialization

Two options spring to mind. One is to use YAML for your serialization. It's fast and relatively safe. The other option would be to try Pixie. You would create an object wrapper around your data structure and use Pixie to store it in a database.

use Pixie; my $pixie = Pixie->new->connect(@connection_paramters); my $cookie = $pixie->insert($any_object);

At that point, you just cache your cookie however you want. Later, when you want the object back, retrieve the cookie and...

$pixie->get($cookie)

You can also bind names to your objects and fetch by name, if you prefer. I don't know if that would be faster, but it can present a clean interface.

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: Re: Using bytecode for object serialization
by tall_man (Parson) on Sep 26, 2003 at 18:19 UTC
    I tried YAML just now and I was very disappointed by it. Not only did it take 14 seconds to load what Data::Dumper can do in .3 seconds, but it is buggy as well. It died on the hash key below until I supplied by own quotation marks around it!
    Trade Route (Eastern Range, Yellow):

    Update: Storable beats everything else so far, among methods that pull the whole data structure into memory:

    Storable: .17 secs
    Data::Dumper, byte encoded: .31 secs
    Data::Dumper: .32 secs
    YAML: 14.2 secs