Hi Stas,
Am Montag, 16. Februar 2004 12:39 schrieb Stas Bekman:
> Boris Zentner wrote:
> [...]
>
> >>so lookup_method internally finds two entries. none of them matches
> >>My::RequestRec. So it checks isa() and finds that the first entry
> >> matches. It should now return 'Apache::RequestIO', which AUTOLOAD loads
> >> and now when it calls goto, it calls that method.
> >
> > Yes, that is exactly what happened here. But it is wrong.
> > from your example:
> > Apache::RequestIO is returned. now
> > eval { require 'Apache::RequestIO' } loads the class/package.
> >
> > but the next line 'goto &$AUTOLOAD' calls My::RequestRec::print and
> > produce the endless loop. Since we need to call Apache::RequestRec::print
> > _not_ My::RequestRec::print.
>
> I see. So we probably need to call:
>
> shift->$AUTOLOAD
>
something like
my $c = shift;
$AUTOLOAD =~ /(\w+)$/;
$c->$1(@_);
looks funny, but the we need to handle the return part too. That might be not
so nice for any case.
> then? which this time will find print() on its own, since Apache::RequestIO
> is now loaded.
>
> Not sure about the AUTOLOAD goto magick though. Ideas?
>
> May be having method_lookup return the package name will allow us to call:
>
> Apache::RequestRec::print(@_);
>
> But if there is a way to call the object method via goto, that would be the
> simplest way.
>
Without too much thinking I prefere if method_lookup would return the full
qualified method name ( Apache::RequestRec::print ).
Then we can call goto &$method.
--
Boris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]