|
|
| There's more than one way to do things | |
| PerlMonks |
Re: OO Perl and AUTOLOADby shemp (Deacon) |
| on Apr 08, 2005 at 12:54 UTC ( [id://446081]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
In the code you provided, you never directly look in the %_attribute_properties. It appears that your accessor only knows the type of the thing being accessed, because you have set the value with the mutator. If you modify the accessor so that it checks if the attribute exists, and if not, find the type of the attribute from the %attribute_properties, then the proper type should be returned.
As a nitpick, why not return references to the array and hash attributes, then you dont need to play dereferencing games, let the caller, because they need to know the type already...unless of course you want to return deep copies.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||