Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Generating accessors for complex structures inside the object

by KSURi (Monk)
on Jan 11, 2008 at 21:55 UTC ( [id://661996]=note: print w/replies, xml ) Need Help??


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

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
  • Comment on Re^2: Generating accessors for complex structures inside the object
  • Download Code

Replies are listed 'Best First'.
Re^3: Generating accessors for complex structures inside the object
by kyle (Abbot) on Jan 11, 2008 at 22:06 UTC

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://661996]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-26 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found