Clear questions and runnable code
get the best and fastest answer
removing someone elses AUTOLOADby water (Deacon)
|on Dec 04, 2005 at 12:58 UTC||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.
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.
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.
PS I think I recall in Damian's PBP Dog book, he states AUTOLOADs are bad, and I agree! Too much magick.