in reply to Re: Re: Private namespace package question
in thread Private namespace package question
apprentice wrote:
is there any way to have one module load all the modules everything would need and then allow all other modules to use the subs of those modules without having to prepend the package names(as long as they were exported)?
Um, yes, but you really don't want to do it. What it involves is writing a custom import routine in Private.pm and then using goto to call the other modules import routines (this prevents the call stack from being updated):
sub import { # using goto to avoid updating caller # This will export everything to the package # that called this one goto &Foo::import; }
Hmm... in retrospect, this also means the you can only export one package's subs from here. This is a tougher problem than I thought. On the other hand, whenever someone winds up trying to do stuff this tricky, it usually means that a redesign should be considered.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 4: Private namespace package question
by tilly (Archbishop) on Jan 05, 2002 at 19:47 UTC |