Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Generating accessors for complex structures inside the object

by lima1 (Curate)
on Jan 11, 2008 at 19:11 UTC ( #661954=note: print w/replies, xml ) Need Help??


in reply to Generating accessors and mutators for complex structures inside the object

You will find some hints here: a simple matter of elegance.
  • Comment on Re: Generating accessors for complex structures inside the object

Replies are listed 'Best First'.
Re^2: Generating accessors for complex structures inside the object
by KSURi (Monk) on Jan 11, 2008 at 21:55 UTC
    Thanks for the link, but I have a more complex situation. The above Hashref is not static name. Here's a good example of what I need:
    $self = { A => { B => 'C' }, D => { E => { F => 'G' } } }
    So there are 2 hasrefs in example (in real code there will be more) inside the object. I need this methods to be generated:
    • A - would get/set the whole 'A' hashref
    • B - would get/set the 'B' key of the 'A' hashref
    • D - would get/set the whole 'D' hashref
    • E - would get/set the whole 'E' hashref
    • F - would get/set the 'F' key of the 'E' hashref

      What do you want to do if somewhere in your jungle of hashes you have two keys with the same name?

      $self = { A => { A => 'C' }, };

      Does the structure have cycles in it?

        All the keys have 100% guaranted unique names

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661954]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2021-04-15 05:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?