in reply to CaptureStructure and RestoreStructure

As I'm reading through this, I'm not sure this is any simpler than the interface provided by FreezeThaw or my personal favorite Storable. Perhaps you should check into those before spending time maintaining your code, or at least see how they do it.

-- Randal L. Schwartz, Perl hacker

  • Comment on RE: CaptureStructure and RestoreStructure

Replies are listed 'Best First'.
RE: RE: CaptureStructure and RestoreStructure
by rhardy (Acolyte) on Aug 11, 2000 at 10:45 UTC
    If Storable worked with multi-dimensional hashes this code would be of little value. Storable doesn't allow it, or at least it didn't want to do it for me and no one on here responded with a suggestion on how to get it to work. See "Storable.pm: Storing Multi-dimensional Hashes How?" Even Datadumper had a bug in it which made the storing of multidimensional hashes a problem; $Datadumper::quotekeys=1 is ignored after the first dimension of the hash. Fortunately, DumperX works properly but obviously this is only available on platforms with XS extensions to Datadumper. Hopefully, the author of Datadumper will find the glitch in short order.
      (I don't know why you made two threads on this, so I'll make two replies :)

      I've not seen problems with Storable yet, and I'm creating a monster multidimensional hash every night with my website link verifier for months now.

      Please demonstrate your problem, and we can work together to either figure out what's wrong with your code or what's wrong with Storable.

      -- Randal L. Schwartz, Perl hacker

        One reply for each side of my brain ? ;o) Anyways... I have my code RCSed, I will see if I can find an example of the problem. I tried several different functions before I finally rolled my own. I recall one of the functions was replacing hash references with '1' on restore that cut out all sorts of data: i.e. 1 instead HASH(0x4563473). I also received the error message mentioned in this thread at one point. I will work on that example... -- Robert Hardy
RE: RE: CaptureStructure and RestoreStructure
by rhardy (Acolyte) on Aug 11, 2000 at 10:16 UTC
    I don't proclaim to be an expert (I've been coding for ~6 years now), however I have been unable to get FreezeThaw or Storable to properly dump a multi-dimensional hash. They have always mangled the hash. What is worse is they do not report this mangling. Storable was beautiful and fast before I realized it was doing this. I don't want to fool around hacking down the dimension of my arrays to gain persistence. I wanted a simple procedure which would always work. There are a couple of typo in those functions which I forgot to update. I will post the updates shortly. If I'm wrong about Storable & FreezeThaw please tell me but my tests have shown that there isn't anything out there that handles everything in a generic manner.
      I've not seen it "mangle the hash" yet. If you have a specific example to show, please do so, and we can walk through it together, either figuring out what got misunderstood, or submitting a bug report.

      -- Randal L. Schwartz, Perl hacker