Hi Stas,

Am Donnerstag, 12. Februar 2004 18:49 schrieb Stas Bekman:
> > The biggest drawback for me is whenever inherence comes into play it wont
> > work. Method_lookup is a hack. It is nice to have, but it whould much
> > better if it is not needed at all.
>
> Do you suggest that AUTOLOAD doesn't work with inheritance? Doesn't it call
> the right AUTOLOAD function?

Yes, AUTOLOAD has some drawbacks. During my testing I found two of them 
imediately.

        1. You can not rely on ->can. If I have a object and ask $obj->can('print') 
The answer is yes it can print, or I do not know maybe we can load print try 
it! Thats odd. But not a mod_perl issue.

        2. EazyLife can not know about my methods, so the option is guess and load 
all classes with methods that may satisfy me or ignore me. I dislike both and 
Apache::Request forwards everything unknown to the environ object, but it 
seems it looks what the object can ( untested ) so nothing is forwarded until 
the class is loaded.

Back to EazyLife:
It calls the AUTOLOAD function and in my case it is the right one. But if My 
class is a new one ( one that is not part of mod_perl ) then 
ModPerl::MethodLookup simply find nothing and dies.

suppose this ( untested and useless ) example:

package SuperRequestRec;
our @ISA = qw!Apache::RequestRec!;
sub new {
  my $class = shift;
  return bless shift, $class;
} 
1;

sub handler :method {
  my ( $c, $r ) = @_; 
  my $sr = SuperRequestRec->new( $r );
  $sr->print("Hi");
  return DONE;
}

see this line from EazyLife.pm

            ModPerl::MethodLookup::lookup_method($AUTOLOAD, @_);

$AUTOLOAD may be SuperRequestRec::print

and $_[0] is a reference to SuperRequestRec.

-- 
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to