daverave has asked for the wisdom of the Perl Monks concerning the following question:

I'm experiencing some trouble with MooseX::Storage. You can read more about it at SO.

It seems to me as if my use of MooseX::Storage causes object duplication: suppose I'm serializing obj1, which has multiple references to an instance of obj2. Before serialization, there's only a single copy of obj2 (and multiple references to it). After serialization and de-serialization there are multiple copies of obj2.

Is that how MooseX::Storage suppose to work?

  • Comment on Does MooseX::Storage duplicate an object referenced multiple times?

Replies are listed 'Best First'.
Re: Doess MooseX::Storage duplicate an object referenced multiple times?
by Corion (Patriarch) on Oct 25, 2010 at 12:49 UTC

    Why don't you give the people at Stackoverflow a little bit more than 20 minutes to reply before reposting your question here?

    And if it is so important, what's keeping you from trying things out yourself?

      I am trying. I thought it might be related to the storage method. Tried both YAML, Storable and JSON.

      When I inspect the JSON/YAML files it seems as if the Rep object indeed appears multiple times. I'd expect to appear explicitly only once, then only have JSON/YAML internal references to it.

        Information on how MooseX::Storage handles object references is notably absent. My approach would be to serialize and then deserialize a structure and then check whether you got one or two references what originally was just one reference to a common object.

        Maybe you want KiokuDB, also by at least one author of MooseX::Storage.