You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@eXtropia.com> on 2002/09/27 12:12:33 UTC

[Patch] Apache->httpd_conf (compat)

Index: STATUS
===================================================================
RCS file: /home/cvspublic/modperl-2.0/STATUS,v
retrieving revision 1.12
diff -u -I'$Id' -I'$Revision' -r1.12 STATUS
--- STATUS      17 Sep 2002 02:46:20 -0000      1.12
+++ STATUS      27 Sep 2002 10:09:11 -0000
@@ -58,8 +58,6 @@
   handler to actually convert the Perl code into apache config
   [Philippe M. Chiasson <go...@cpan.org> is working on one]
 
-* Apache->httpd_conf compat method mapping to Apache::Server->add_config
-
 * directive handlers are supported but need some work for 1.x compat
   - Apache::ModuleConfig->get needs a compat method mapping to
     Apache::Module->get_config

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 10:09:13 -0000
@@ -110,6 +110,13 @@
     Apache->server->log_error(@_);
 }
 
+sub httpd_conf {
+       shift;
+       my $err = Apache->server->add_config([split /\n/, join '', @_ ]);
+       die $err if $err;
+       return;
+}
+
 package Apache::Constants;
 
 use Apache::Const ();

Index: t/response/TestCompat/apache.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestCompat/apache.pm,v
retrieving revision 1.2
diff -u -I'$Id' -I'$Revision' -r1.2 apache.pm
--- t/response/TestCompat/apache.pm     29 Aug 2002 02:28:44 -0000      1.2
+++ t/response/TestCompat/apache.pm     27 Sep 2002 10:09:15 -0000
@@ -16,7 +16,7 @@
 sub handler {
     my $r = shift;
 
-    plan $r, tests => 6;
+    plan $r, tests => 7;
 
     $r->send_http_header('text/plain');
 
@@ -39,7 +39,12 @@
 
     ok t_cmp("httpd/unix-directory", DIR_MAGIC_TYPE,
              'DIR_MAGIC_TYPE');
-
+       
+       my $admin = $r->server->server_admin;
+       Apache->httpd_conf('ServerAdmin foo@bar.com');
+       ok t_cmp('foo@bar.com', $r->server->server_admin , 'Apache->httpd_conf');
+       $r->server->server_admin($admin);
+       
     OK;
 }
 

-- 
Philippe M. Chiasson <go...@eXtropia.com>
eXtropia Pte. Ltd.

Re: [Patch] Apache->httpd_conf (compat)

Posted by Doug MacEachern <do...@covalent.net>.
On 7 Oct 2002, Philippe M. Chiasson wrote:

> Like this ?

should have realized it was that simple, but yes just like that :-)


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


Re: [Patch] Apache->httpd_conf (compat)

Posted by "Philippe M. Chiasson" <go...@eXtropia.com>.
On Mon, 2002-10-07 at 10:37, Doug MacEachern wrote:
> thanks, applied.
> note that while the method works at request time, it is not thread safe.
> of course, the 1.x method was never meant to be used at request time.
> could change to use $r->add_config if Apache->request is available just in 
> case.
> 

Like this ?

Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.67
diff -u -I'$Id' -I'$Revision' -r1.67 compat.pm
--- lib/Apache/compat.pm        7 Oct 2002 02:44:30 -0000       1.67
+++ lib/Apache/compat.pm        7 Oct 2002 04:15:21 -0000
@@ -112,7 +112,7 @@
 
 sub httpd_conf {
     shift;
-    my $err = Apache->server->add_config([split /\n/, join '', @_]);
+    my $err = (Apache->request || Apache->server)->add_config([split /\n/, join '', @_]);
     die $err if $err;
 }
 

-- 
Philippe M. Chiasson <go...@eXtropia.com>
eXtropia Pte. Ltd.

Re: [Patch] Apache->httpd_conf (compat)

Posted by Doug MacEachern <do...@covalent.net>.
thanks, applied.
note that while the method works at request time, it is not thread safe.
of course, the 1.x method was never meant to be used at request time.
could change to use $r->add_config if Apache->request is available just in 
case.





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