Aaron Trevena wrote:
On 9/16/05, David Baird <[EMAIL PROTECTED]> wrote:
       # translate the (non-inheritable) function call on handler(),
       # into a method call that inherits from Maypole::run_handler
       *{"$class\::handler"} = sub { $class->_run_handler( @_ ) };

and rename Maypole::handler to _run_handler().

I like this suggestion it is less of a hack and less tied to mod_perl.

As you all know, I know nothing about mod_perl but I was curious, so I did a quick Google. According to <http://modperlbook.org/html/ch25_01.html>:

=============

25.1.5. Method Handlers

In mod_perl 1.0, method handlers had to be specified by using the ($$) prototype:

package Eagle;
@ISA = qw(Bird);

sub handler ($$) {
    my($class, $r) = @_;
    ...;
}

Starting with Perl Version 5.6, you can use subroutine attributes, and that's what mod_perl 2.0 does instead of conventional prototypes:

package Eagle;
@ISA = qw(Bird);

sub handler : method {
    my($class, $r) = @_;
    ...;
}

See the attributes manpage.

mod_perl 2.0 doesn't support the ($$) prototypes, mainly because several callbacks in 2.0 have more arguments than $r, so the ($$) prototype doesn't make sense any more. Therefore, if you want your code to work with both mod_perl generations, you should use the subroutine attributes.

============

If I interpret this correctly, we should delete the naughty code altogether, add the method attribute to Maypole::handler() and EverythingWillJustWork.

Cheers, Dave



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel

Reply via email to