Well..... never mind, I've answered my own question. The AUTOLOAD
function does what I need nicely

package FOO;
use Module;
use vars qw(@ISA);
@ISA = qw(Module);

sub AUTOLOAD {
  my $pkg_sub = $AUTOLOAD;
  my ( $pkg, $sub) = split(':',$pkg_sub);
  return &Module::->$sub($pkg,@_);
}

this nicely imports all the subroutines from 'Module", but marks them
for "caller" on the other end as being from this named package, or the
first variable (as above) can simply be shipped over to avoid the
necessity to use "caller" on the Module end.


> I have a handler which is called by Apache. The handler loads a
> module which has all the real subroutines within it that are
> executed. Ordinarily, a simple @EXPORT or @EXPORT_OK would provide
> the subroutines to the handler, but when Apache does the handoff,
> the PACKAGE name from the handler does not follow into the module
> subroutine, rather it is identified as Apache::Blah
> 
> i.e.
> 
> #handler
> package MyHandler;
> 
> use Module qw(sub1 sub2);
> use Apache;
> use vars qw(@ISA)
> @ISA = qw (Module Apache);
> 
> calling sub1 from apache
> using THIS handler named "MyHandler" results in Module::sub1 
> identifing the "caller" as Apache.
> 
> what is desired can be accomplished by
> 
> package MyHandler;
> use Module
> use Apache;
> use vars qw(@ISA)
> @ISA = qw (Module Apache);
> 
> sub sub1 {
>   return Module::sub1{@};
> }
> 
> now Module correctly identifies the caller as "MyHandler"
> 
> there are many routines in "Module", there ought to be a better way
> to do this. Any ideas would be appreciated.
> 
> One thought I had was to use a series of pointers
> \*sub1 = *routine;
> etc...
> 
> where & routine would identify the subroutine called. However, I
> don't know how to id the subr call.
> 
> Michael
> [EMAIL PROTECTED]
> 

Reply via email to