http://qs321.pair.com?node_id=661954


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