Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

(MeowChow) Re: Reinventing the wheel: Dumper Difficulties

by MeowChow (Vicar)
on Apr 11, 2002 at 04:11 UTC ( #158222=note: print w/replies, xml ) Need Help??

in reply to Reinventing the wheel: Dumper Difficulties

Have you taken a look at Data::Denter? Although the output format is not evalable (it has to be "undented"), I believe it handles circular references. I'm not sure if it deals with all the cases mentioned here, but it would be a good idea to make sure you're not reinventing a reinvented wheel :-)
               s aamecha.s a..a\u$&owag.print
  • Comment on (MeowChow) Re: Reinventing the wheel: Dumper Difficulties

Replies are listed 'Best First'.
Re: (MeowChow) Re: Reinventing the wheel: Dumper Difficulties
by demerphq (Chancellor) on Apr 11, 2002 at 08:44 UTC
    Well, Im familiar enough with Data::Denter to know that it doesnt meat at least one my needs.

    One key issue for me is not that the dumper chosen can "handle" cyclic structures, but that it deals with them in a reasonable way.

    Consider a situation where we have an array of objects, perhaps representing people. Now each object contains an array of references to some or all of the other objects, perhaps representing some kind of relationship between them. Now if I use depth first dumper to dump this array of objects, the dumper will dump the first object and then follow the references dumping each object (which are not children!) as if they were children of the first object. Almost inevitably this will result in a large chunk of the top level array containing references into the tree of parent and children objects. This is not what I want.

    What I would rather see is an array containing objects which contain an array with references to the other objects. The fact that an object is in the top level array means that it should be first mentioned in the context of this array, not as a child of another object.

    Some other functionality that ive built in (and wanted)includes "slicing" out a many mentioned object and declaring it first so that instead of having many "fix" statements at the end we can simply have this object mentioned multiple times. In fact ive got this implemented in such a way that the user can specify how many times an object needs to be referenced before it gets split out.

    In fact is precisely the "splitting" function that made me fail merlyns test case. I need to resolve this in the next few days, but once I do I will be able to handle both of merlyns tests.

    Oh and did I mention that I convert code refs to code when I dump?

    Yves / DeMerphq
    Writing a good benchmark isnt as easy as it might look.

      Oh and did I mention that I convert code refs to code when I dump?

      I sometimes read the newspaper. ;-)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://158222]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2018-04-25 03:18 GMT
Find Nodes?
    Voting Booth?