in reply to Re: Altering Package Subs and Running In To Problems
in thread Altering Package Subs and Running In To Problems
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::$_"}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Altering Package Subs and Running In To Problems
by steves (Curate) on Nov 11, 2004 at 13:12 UTC | |
by Bovine (Initiate) on Nov 11, 2004 at 22:48 UTC | |
|
Re^3: Altering Package Subs and Running In To Problems
by Aighearach (Initiate) on Nov 11, 2004 at 11:47 UTC | |
by Bovine (Initiate) on Nov 11, 2004 at 23:50 UTC | |
|
Re^3: Altering Package Subs and Running In To Problems
by simonm (Vicar) on Nov 11, 2004 at 17:43 UTC | |
by Bovine (Initiate) on Nov 11, 2004 at 23:12 UTC |