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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Philippe M. Chiasson <[EMAIL PROTECTED]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]