Perl: the Markov chain saw | |
PerlMonks |
Re: Perl's equivalent to Python's hasattr and getattr? (class variable details)by Ovid (Cardinal) |
on Jul 28, 2005 at 23:51 UTC ( [id://479179]=note: print w/replies, xml ) | Need Help?? |
Regrettably, Perl does not have a clean distinction between classes and instances of said classes. As a result, class data is something that folks tend to forget about. One way of creating your set method is to store your class data in a hash.
If you don't like the validation, you could have each value in %CLASS_DATA be a sub ref that points to the real setter. Personally, I've enjoyed Class::MethodMaker to handle much of this for me, though the recent test failures are disheartening. Cheers, New address of my CGI Course.
In Section
Seekers of Perl Wisdom
|
|