You might like to look at
MLDBM, which allows pluggable serialization methods, as well as pluggable storage methods. Basically, you specify what to serialize with (say
Storable), and what to tie with (say
DB_File), and it gives you transparent persistence.