Practical mod_perl / HTML Version / books


previous page: 25.1.4. ModPerl::Registry Familypage up: HTML Version of the booknext page: 25.1.6. Apache::StatINC Replacement

25.1.5. Method Handlers


Search







modperlbook.org


 HTML Version


 PDF Version


 Download Code


 Table of Contents


 Errata


 mod_perl2 User's Guide


 Sitemap





Add to Google



Creative Commons License


Written by
Eric Cholet (Logilune)
and Stas Bekman (StasoSphere).

Hosted by ibiblio.org.




























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:

  • prev: 25.1.4. ModPerl::Registry Family
  • Table of Contents
  • next: 25.1.6. Apache::StatINC Replacement

Tags

mod_perl, modperl, Apache, perl, cgi, html, mod_perl, e-commerce, scalability, free, open source, OSS, apache, squid, high availability, modperl, linux, unix, Web, www, mod_perl, webserver, admin, apache, book, webmaster, tools, modperl, guide, docs, documentation, help, mod_perl, perl, information, apache, script, errata, eric cholet, perl, apache, mod-perl, stas bekman, mod_perl, cool, perl, Apache, performance, speed, choice




Other projects to check out: meta-religion.com is for those interested in Religious, Spiritual and Esoteric Phenomena. i-want-a-better.com is a community of people discussing what they would like to be improved in their lives and things they use and interact with. You may also want to find a healer in your area or read articles on variety of topics.






TOP
previous page: 25.1.4. ModPerl::Registry Familypage up: HTML Version of the booknext page: 25.1.6. Apache::StatINC Replacement

© 2007 StasoSphere

[ Privacy Policy ] [ Terms of Use ] [ About Authors ] [ Search ]

Last modified Wed May 7 06:27:44 2008