in reply to Need a module for persistence of dynamic objects
More specifically, the code is an MP3 server that goes and gets a playlist from a DB (all a playlist is is a bunch of fully qualified mp3's, one per line in a text file).
My playlists are generated by getting a list of mp3's storing them in an array, freezing (using Storable) the array, unpacking it to hex to remove any naughty characters, then storing in a RDMBS using DBI. BINDVAR=> unpack("H*",freeze(\@{$params{PLAYLIST}}))
My server then does the reverse. It goes and gets the playlist, packs it pack up, thaws it, and the result is the same array I put in there when the playlist was generated.
sub { .. .. my @ary = $sth->fetchrow_array; .. .. my $retval = thaw(pack("H*", @ary) ); return @{$retval} }
I'm currently working on a module that will do specifically what you are after (persistant storage in a db) to hone my OOP skills, so if you have any suggestions, /msg me, I'm open to ideas.
|
|---|