You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Josh Chamas <jo...@chamas.com> on 2002/09/19 21:46:09 UTC

Apache::compat possible extensions...

Hey mod_perl developers,

I am beginning to work with mod_perl, porting things like
Apache::ASP & the Hello World benchmarks, and am finding
some things that could be improved.

Can we get the old

   %args = $r->args

functionality back, at least in Apache::compat mode?
This is just for basic param parsing I use in some of
the benchmarks.  I could have used Apache::Request->param possibly,
but it seems that does not exist yet under 2.0

Also, can Apache::compat be trigger automatically by
the perl-script directive?  Since the perl-script directive,
as opposed to the new modperl one, seems to have lots
of backwards compatibility hooks, how about just hooking
up Apache::compat to it too?  Otherwise, I think module
authors will have to add it themselves to all the modules
to explicitly maintain compatibility with 2.0.

The effect of this is that modules that are not being actively
maintained will automatically break under 2.0, and there are *so many*
Apache modules out there.  This allows perl-script to pretty
much "just work" like it used to, while still providing an
upgrade path to modperl directive for those that want to use
the new APIs explicitly.

Thanks for all the work so far, it looks like it has shaped
up really well.

Josh
________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: Apache::compat possible extensions...

Posted by Josh Chamas <jo...@chamas.com>.
Philippe M. Chiasson wrote:
> 
> Wouldn't this make both $r->args and $r->Apache::args work under
> Apache::compat? Works for me.
> 

I think this is great! The more we can get mod_perl2 Apache::compat
to work like before, the faster we'll see Apache::* module developers
port over to the new platform.

Regards,

Josh
________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: Apache::compat possible extensions...

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Fri, 2002-09-20 at 04:10, Doug MacEachern wrote:
> On Thu, 19 Sep 2002, Josh Chamas wrote:
> 
> > Hey mod_perl developers,
> > 
> > I am beginning to work with mod_perl, porting things like
> > Apache::ASP & the Hello World benchmarks, and am finding
> > some things that could be improved.
> > 
> > Can we get the old
> > 
> >    %args = $r->args
> > 
> > functionality back, at least in Apache::compat mode?
> 
> it's there, but you need to invoke as:
> %args = $r->Apache::args;
> (also works with 1.x)

Wouldn't this make both $r->args and $r->Apache::args work under
Apache::compat? Works for me.

Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.66
diff -u -I'$Id' -I'$Revision' -r1.66 compat.pm
--- lib/Apache/compat.pm        24 Aug 2002 16:26:22 -0000      1.66
+++ lib/Apache/compat.pm        27 Sep 2002 03:36:26 -0000
@@ -218,14 +218,20 @@
     } split /[=&;]/, $string, -1;
 }
 
-#sorry, have to use $r->Apache::args at the moment
-#for list context splitting
-
+{
+my $xs_args;
 sub Apache::args {
     my $r = shift;
-    my $args = $r->args;
+    my $args = $r->$xs_args();
     return $args unless wantarray;
     return $r->parse_args($args);
+}
+
+if(not $old_args) {
+    no warnings;
+    $xs_args = \&Apache::RequestRec::args;
+    *Apache::RequestRec::args = \&Apache::args;
+}
 }
 
 sub content {

Index: t/response/TestCompat/request_body.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestCompat/request_body.pm,v
retrieving revision 1.1
diff -u -I'$Id' -I'$Revision' -r1.1 request_body.pm
--- t/response/TestCompat/request_body.pm       15 Aug 2002 09:35:11 -0000      1.1
+++ t/response/TestCompat/request_body.pm       27 Sep 2002 03:36:30 -0000
@@ -28,7 +28,7 @@
         %data = $r->content;
     }
     else {
-        %data = $r->Apache::args;
+        %data = $r->args;
     }
 
     return DECLINED unless exists $data{test};



> > Also, can Apache::compat be trigger automatically by
> > the perl-script directive?  Since the perl-script directive,
> > as opposed to the new modperl one, seems to have lots
> > of backwards compatibility hooks, how about just hooking
> > up Apache::compat to it too?  Otherwise, I think module
> > authors will have to add it themselves to all the modules
> > to explicitly maintain compatibility with 2.0.
> 
> perl-script is not just backwards compat, it is for a CGI-ish 
> environment.  sets up %ENV, *STD{IN,OUT}, etc.  whereas the 'modperl' does 
> nothing special, just calls the handlers.
> 
> unlike 1.x, 2.x does not load anything unless you tell it to.
> loading of Apache::compat will not be made automatic, its a 1-line config 
> change in httpd.conf:
> 
> PerlModule Apache::compat
> 
> that's pretty painless considering what it takes to port a C module.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
-- 
Philippe M. Chiasson <go...@cpan.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: Apache::compat possible extensions...

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 19 Sep 2002, Josh Chamas wrote:

> Hey mod_perl developers,
> 
> I am beginning to work with mod_perl, porting things like
> Apache::ASP & the Hello World benchmarks, and am finding
> some things that could be improved.
> 
> Can we get the old
> 
>    %args = $r->args
> 
> functionality back, at least in Apache::compat mode?

it's there, but you need to invoke as:
%args = $r->Apache::args;
(also works with 1.x)

> Also, can Apache::compat be trigger automatically by
> the perl-script directive?  Since the perl-script directive,
> as opposed to the new modperl one, seems to have lots
> of backwards compatibility hooks, how about just hooking
> up Apache::compat to it too?  Otherwise, I think module
> authors will have to add it themselves to all the modules
> to explicitly maintain compatibility with 2.0.

perl-script is not just backwards compat, it is for a CGI-ish 
environment.  sets up %ENV, *STD{IN,OUT}, etc.  whereas the 'modperl' does 
nothing special, just calls the handlers.

unlike 1.x, 2.x does not load anything unless you tell it to.
loading of Apache::compat will not be made automatic, its a 1-line config 
change in httpd.conf:

PerlModule Apache::compat

that's pretty painless considering what it takes to port a C module.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org