Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
removing someone elses AUTOLOADby water (Deacon) |
on Dec 04, 2005 at 12:58 UTC ( [id://513944]=perlquestion: print w/replies, xml ) | Need Help?? |
water has asked for the wisdom of the Perl Monks concerning the following question:
I am using a third-party module that uses AUTOLOAD to allow you to call options in a "convenient" way.
The autoload isn't needed -- you can set the options with an explicit $obj->options() method, but the author I guess thought it'd be nice to allow $obj->some_random_option() calls and used AUTOLOAD for this. Yuck. And the author's AUTOLOAD doesn't check anything, it just dispatches everything to $obj->option(some_random_option=>blah blah), without checking if some_random_option is supported. I'm encountering some errors in the module, which I don't fully understand yet, which lead to the objects unexpected demise, which leads to a DESTROY call, which AUTOLOAD happily dispatches to options. Yuck again. Is there a way for me, while debugging, to mangle the symbol table to remove Foo::Bar::Baz::AUTOLOAD subroutine? I do not / can not modify Foo/Bar/Baz.pm. Thanks! PS I think I recall in Damian's PBP Dog book, he states AUTOLOADs are bad, and I agree! Too much magick.
Back to
Seekers of Perl Wisdom
|
|