Syntactic Confectionery Delight | |
PerlMonks |
Re: Autoload versus auto-generating accessorsby kbrannen (Beadle) |
on Feb 29, 2016 at 17:30 UTC ( [id://1156466]=note: print w/replies, xml ) | Need Help?? |
I almost never use AUTOLOAD for performance reasons and to avoid the issue of it going to the wrong parent (if using inheritance). No, I've never had it go to the wrong parent, I'm just concerned about that. :) If the number of "getters" is 5 (or so) or less, I just hand code them. If it's a larger number, then I do something like the AM does above with: I might have to have a hash or something that maps english names to internal names to help that out, but still, that's the basics of it and I've been pleased with it. I always hand code "setters" because there are normally so few of them, but I could do the above method for them too if I had to. HTH, Kevin
In Section
Meditations
|
|