Herkum has asked for the wisdom of the Perl Monks concerning the following question:
Can someone help me fill in the blank about how I should do this?# Hash Value $hash{'name'} = 'Herk'; $self->get_name(); # Returns 'Herk'
Update
Let me state what I am avoiding trying to do. I don't want to have to create methods for every key in my hash. If I have a 100 keys I COULD write 100 get methods and 100 set methods but that is alot of work.
What I was hoping for was for one or two methods that evaluates a 'get_' or 'set_' calls, intercepts it and does an operation with my hash based upon the method name. That way all I have to worry about is making sure all my fields are in the hash.
Sorry, I was unclear in explaining what I wanted.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Link methods to hash values
by shmem (Chancellor) on Oct 01, 2006 at 21:36 UTC | |
|
Re: Link methods to hash values
by Hue-Bond (Priest) on Oct 01, 2006 at 18:12 UTC | |
|
Re: Link methods to hash values
by GrandFather (Saint) on Oct 01, 2006 at 19:03 UTC | |
by chromatic (Archbishop) on Oct 01, 2006 at 23:30 UTC | |
by Herkum (Parson) on Oct 01, 2006 at 19:08 UTC | |
by friedo (Prior) on Oct 01, 2006 at 19:18 UTC | |
by Herkum (Parson) on Oct 01, 2006 at 20:53 UTC | |
by tinita (Parson) on Oct 02, 2006 at 08:03 UTC | |
|
Re: Link methods to hash values
by lyklev (Pilgrim) on Oct 01, 2006 at 19:06 UTC | |
by Herkum (Parson) on Oct 01, 2006 at 22:34 UTC | |
|
Re: Link methods to hash values
by GrandFather (Saint) on Oct 01, 2006 at 18:15 UTC | |
|
Re: Link methods to hash values
by jeteve (Pilgrim) on Oct 02, 2006 at 14:53 UTC |