Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

(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]
[Lady_Aleena]: marioroy, I can't decide whether or not to move my RolePlaying:: Random:: modules to just Random::. I'm not as sophisticated as most here.
[marioroy]: Naming things can be difficult, sometimes more so that the actual code :)
[karlgoethebier]: Lady_Aleena: You need to jump to some conclusion
[Lady_Aleena]: And what would I rename RolePlaying/Random .pm to if I move all the RolePlaying/Random modules to just Random? Random/ Random/, maybe lowercase the file name to indicate it is a bit different? I don't know yet.
[marioroy]: What does Random do?
[karlgoethebier]: https://www. v=42WNHGr1jGI
[Lady_Aleena]: karlgoethebeir, I finished another project tonight, making a module which printed stop printing. It was a headache and a half.
[karlgoethebier]: Lady_Aleena: Try it!
[Lady_Aleena]: marioroy, it has 3 subroutines which can be fed data to generate random things. See here.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-05-29 08:58 GMT
Find Nodes?
    Voting Booth?