|Perl Monk, Perl Meditation|
Mixing @EXPORT and use baseby bmcatt (Friar)
|on Jul 07, 2004 at 17:48 UTC||Need Help??|
bmcatt has asked for the
wisdom of the Perl Monks concerning the following question:
Fellow monks, I have a puzzlement... I'm trying to figure out how to re-export subs from one module into another. What's particularly puzzling is that, while I can come up with a version that works (although it's a bit kludgey-er than I'd like), when I swap to use base, it doesn't.
Here's what I've got that works:
With the above bits, I get the correct behavior - which is to say that I can access external() from Bar.pm. However, if I comment out the lines for use Foo;, use vars..., and @ISA... and uncomment use base qw(Foo);, it breaks.
tye had suggested looking into Exporter's export_to_level() or re-calling import, except the idea is to, ideally, need the fewest moving parts in Foo.pm (and none at all in Bar.pm).
And, yes, I'm aware of Spiffy, but I'd prefer something that's a little lighter-weight.
Thoughts, comments, suggestions?