Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: XPath-like method for searching/editing structures

by sundialsvc4 (Abbot)
on Oct 10, 2012 at 13:32 UTC ( #998230=note: print w/replies, xml ) Need Help??

in reply to XPath-like method for searching/editing structures

As an aside, it can be useful to rig-up a “data walker” object that will iterate through a data-structure ... search for “walker” ... and then perhaps maintain a push-down stack of such objects.   Once, I solved a similar problem by devising a walker that would call a specified sub (coderef ...) when it found a matching node.   Each subroutine in turn made the decisions that needed to be made at that level, and spawned another walker-instance to proceed further.   Thus, the walkers handled the task of navigation while the subroutines made the case-specific decisions.   (It was a lot easier to do than to describe.)   I did it this way because, while I could not predict what the shape and depth of the structure would be, I could describe the logic as a small number of reusable, node-specific cases.

  • Comment on Re: XPath-like method for searching/editing structures

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2017-09-22 10:56 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (261 votes). Check out past polls.