This section is from the "Practical mod_perl" book, by Stas Bekman and Eric Cholet. Also available from Amazon: Practical mod_perl
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.
 
Continue to: