in reply to Storing and retrieving a hash of objects

It looks like in your use of Storeable, you are not just storing a hash, but are storing a hash whose values are objects of a class. Storable won't know how to serialize and de-serialize those objects unless it can find that out from the class. The first thing to check is whether Set::IntervalTree provides the methods that Storable needs. I'm guessing that it doesn't.

The documentation to Storable tells you about the methods it needs in the Wizards Only --> Hooks section of the docs.

Hope that gets you the basics of what you need to decide how deep you want to get. Someone else may have a recommendation on how they have serialized Set::IntervalTree objects. --Rodion

  • Comment on Re: Storing and retrieving a hash of objects

Replies are listed 'Best First'.
Re^2: Storing and retrieving a hash of objects
by Frnak (Initiate) on Sep 03, 2013 at 12:41 UTC
    Hi Rodion,
    thanks for your fast answer and sorry for my late reply,
    had no internet access the last few days.
    So as I understand this de/serialization fails as
    Storable does not know how to do it for a
    Set::IntervalTree object.
    This means that I either find a way to let Storable
    know how to do it or choose an other object type to store.
    I tried to figure out how to do some Storable wizardry
    but I guess it's over the top for my problem.
    If anyone has the will to give me a hint on how one
    could do this I'm very willing to try, but I guess it
    would take some time which may be better spent otherwise.

    For the moment I'll try to use an alternative object to store my coordinates. Thanks again for your help!
      It would take a little work to put together serialization routines for Set::IntervalTree and Storable to play smoothly together. That may be worth it if you're going to make heavy use of this, but a quick workaround is to write specialized serialization and de-serializetion routines good enough for your own code and use those convert from a hash of objects to a hash of strings and back. Then you can use Storable on the hash of strings. It sounds like you're thinking along these lines already.

      One advantage of this approach is that if you decide to do the more general job, you've got some prototyping already under your belt.