You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2002/11/11 17:21:06 UTC

Re: [mp2.0] compatibility suggestion

Josh Chamas wrote:
> Hey mod_perl users/developers,
> 
> In short what I think we need is for the modperl2 perl-script
> configuration directive to automagically load the Apache::compat
> layer, please read below for why.
> 
> ----
> 
> I am working on the Hello World benchmarks to get them running
> against mod_perl2 so we can get some numbers comparing mod_perl1
> against it, and meanwhile having to port to Apache2/mod_perl2
> for the first time, in this case all of the benchmarks.
> 
> What struck me odd was that even the simplest of handlers would
> not run directly under mod_perl/1.99_05-dev, as in:
> 
> sub handler {
>     my($r) = shift;
>     $r->content_type('text/html');
>     $r->send_http_header();
>     $r->print('Hello ');
>     $r->print('World');
>     200;
> }
> 
> In this case the error was about content_type() not being implemented
> which I could fix by adding:
> 
> use Apache::compat;

Many functions were renamed because they were renamed in Apache 2.0 API. 
Worse, some functions are now have gone (e.g., send_fd). mod_perl keeps 
a consistent API with Apache API.

Because some functions are no longer supported by Apache and were 
replaced by similar functionalities which don't map 1:1 to the old 
functions, Apache::compat provides a slower perl implementation for 
them, but in the long run for production use you don't want to use 
Apache::compat.

> If it is the case that even the most trivial of applications
> need Apache::compat, then why not load the Apache::compat layer
> automatically?  If performance is an issue, or code bloat or
> what not, then perhaps *Apache::compat* layer could be added
> only in case of using the *perl-script* config directive,
> instead of the new modperl directive.

As Doug explained on the dev list, "perl-script" handler is the normal 
mod_perl handler, it's not a backcompat handler.

Just load the Apache::compat if you need it while the dust settles down. 
CGI.pm 2.89 already does that.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com