On 9/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello,What're the meanings of this routine and why people need it? > Thanks. snip
It is a nasty bit of code that creates an accessor/mutator function for a given attribute/member/whatever-oo-people-call-their-data-in-a-object if an method with that name does not already exist. I say it is nasty for 3 reasons: 1. it uses string eval 2. it uses symbolic references 3. it requires you call this function for every accessor/mutator you want to create A much better solution is to use Perl's autoload functionality with an array of the allowed fields/attributes/members/etc. to achieve the same effect and to use Sub::Install within the autoload function if a real subroutine needs to be created. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/