perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Foo JH <jhfoo...@extracktor.com>
Subject Re: Internal Server Error
Date Fri, 24 Aug 2007 03:11:16 GMT
Hello Perrin,

I'm interested in how you defined your handler with the 'method' attribute:
sub handler : method {
...

I've read http://perldoc.perl.org/attributes.html about attributes, but 
it does not seem to suggest that tagging the method attribute to 
subroutine has any programming advantages, unless you're interested to 
list the subroutines with that attribute. But I suspect there's more to it.

Perhaps you can clue me in on this?

Perrin Harkins wrote:
> On 8/21/07, Jeff Pang <pangj@earthlink.net> wrote:
>   
>>> PerlHandler Package::Name
>>>
>>> instead of:
>>>
>>> PerlHandler Package::Name->handler
>>>
>>>       
>> So on the first case,we need to write the handler as
>> sub handler { my $r = shift; ...}
>> because Apache may call the function directly as Package::Name::handler.
>>
>> on the second case,we write handler as,
>> sub handler { my $class = shift; my $r = shift; ... }
>> because '->' is a method calling.
>>     
>
> For method handlers, you also have to declare it differently.
>
> In mod_perl 1:
> sub handler ($$) {
>
> In mod_perl 2:
> sub handler : method {
>
> - Perrin
>   


Mime
View raw message