![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re^2: "Fields" for "Objects"by lodin (Hermit) |
on Jun 10, 2009 at 21:02 UTC ( #770455=note: print w/replies, xml ) | Need Help?? |
I second stvn. Since you know which fields are permitted when the class compiles you can generate them and get rid of AUTOLOAD. AUTOLOAD is really only needed when you do not know which methods the class will need to handle. Now your class acts exactly like it would have acted if you manually wrote the methods, and you pay no run-time penalties. Note how simple the logic of the code is compared to AUTOLOAD. And the AUTOLOAD implementation will get more complicated still. Consider what happens when you
lodin
In Section
Seekers of Perl Wisdom
|
|