P is for Practical | |
PerlMonks |
Re: declaring accessor methods from a listby Trizor (Pilgrim) |
on Apr 26, 2007 at 22:38 UTC ( [id://612284]=note: print w/replies, xml ) | Need Help?? |
sub $name {} isn't working the way you expect it to because named subs are picked up during the compilation of the BEGIN block. What you want to do is edit the GLOB with the name of your accessor in a fasion similar to this:
As an alternative to rolling your own autogenerator you could look on the CPAN as there are several mentioned elsewhere in this thread.
In Section
Seekers of Perl Wisdom
|
|