You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sebastian Riedel <sr...@oook.de> on 2004/02/11 21:10:01 UTC

handler inheritance

Hi,

I have a problem with mod_perl and base.pm, maybe it's a bug,
but i'm not sure yet.

Test machine is: Debian unstable with Apache 1.3.29, mod_perl 1.29
                             and Perl 5.8.3

This is the failure message from error.log:
[Wed Feb 11 19:22:56 2004] [error] Undefined subroutine 
&MyHandler::SubClass::handler called.


These are my two modules:
-------------------------------8<--------------------------------------
# MyHandler.pm
package MyHandler;

use strict;
use Apache::Constants ':common';

sub handler {
    my $r = shift;
    $r->send_http_header('text/plain');
    print "Hello apache\n";
    return OK;
}

1;
-------------------------------8<--------------------------------------
# MyHandler/SubClass.pm
package MyHandler::SubClass;

use strict;
use base 'MyHandler';

1;
-------------------------------8<--------------------------------------

These are my httpd.conf entries:
-------------------------------8<--------------------------------------
<Location /works>
    SetHandler perl-script
    PerlHandler MyHandler
</Location>

<Location /doesnotwork>
    SetHandler perl-script
    PerlHandler MyHandler::SubClass
</Location>
-------------------------------8<--------------------------------------

Cheers,
Sebastian Riedel

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: handler inheritance

Posted by Sebastian Riedel <sr...@oook.de>.
Perrin Harkins wrote:

>On Wed, 2004-02-11 at 15:27, Sebastian Riedel wrote:
>  
>
>>No, that doensn't work, it just gives this failure:
>>
>>[Wed Feb 11 21:22:59 2004] [error] Undefined subroutine 
>>&MyHandler::SubClass->handler::handler called.
>>    
>>
>
>Oh!  I forgot you need to protoype the handler method with ($$).  See
>http://perl.apache.org/docs/1.0/guide/config.html#Perl_Method_Handlers
>
>- Perrin
>
>  
>
That works, thanks!

Cheers,
Sebastian Riedel


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: handler inheritance

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-02-11 at 15:27, Sebastian Riedel wrote:
> No, that doensn't work, it just gives this failure:
> 
> [Wed Feb 11 21:22:59 2004] [error] Undefined subroutine 
> &MyHandler::SubClass->handler::handler called.

Oh!  I forgot you need to protoype the handler method with ($$).  See
http://perl.apache.org/docs/1.0/guide/config.html#Perl_Method_Handlers

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: handler inheritance

Posted by Sebastian Riedel <sr...@oook.de>.
Perrin Harkins wrote:

>On Wed, 2004-02-11 at 15:10, Sebastian Riedel wrote:
>  
>
>><Location /doesnotwork>
>>    SetHandler perl-script
>>    PerlHandler MyHandler::SubClass
>></Location>
>>    
>>
>
>Try
>      PerlHandler MyHandler::SubClass->handler
>
>- Perrin
>
>
>  
>
No, that doensn't work, it just gives this failure:

[Wed Feb 11 21:22:59 2004] [error] Undefined subroutine 
&MyHandler::SubClass->handler::handler called.

Cheers,
Sebastian Riedel

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: handler inheritance

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-02-11 at 15:10, Sebastian Riedel wrote:
> <Location /doesnotwork>
>     SetHandler perl-script
>     PerlHandler MyHandler::SubClass
> </Location>

Try
      PerlHandler MyHandler::SubClass->handler

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html