Hmm... really good idea.
Maybe there still is a way to use 'use' (or one line and still keep it at the top)?
I was also thinking of playing around with the BEGIN, INIT, etc. subs in my Plugin class and seeing if anything like that worked.
Even though the dispatch-ness sounds pretty cool, my goal is to have the base module have all the subs.
Lets say package Foo (base) uses Bar (child) as a plugin. Foo's subs would be overwritten by Bar's (limited by, say, an export hash like Exporter uses), thus letting Foo's subs transparently point to Bar's.
Perl code probably explains this better...
So I could call Foo::something, but actually (permitting Bar does plug into the 'something' subroutine) Bar::something would be called. Kind of like flattening a tetris board (without the falling pieces) such that, at the end, only the blocks that were originally at the top are now lining the bottom.foreach (@Bar::PLUGIN_SUBS) { # error checking and the like *{"Foo::$_"} = \&{"Bar::$_"}; }
In reply to Re^2: Altering Package Subs and Running In To Problems
by Bovine
in thread Altering Package Subs and Running In To Problems
by Bovine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |