cvs commit: modperl-2.0/t/response/TestAPI r_subclass.pm

2003-01-30 Thread stas
stas2003/01/30 20:37:07

  Modified:lib/Apache compat.pm
   t/response/TestAPI r_subclass.pm
  Log:
  adjustments to the new behavior of Apache->request, which asserts when is
  not configured to return the global object
  
  Revision  ChangesPath
  1.76  +4 -2  modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- compat.pm 15 Dec 2002 08:30:40 -  1.75
  +++ compat.pm 31 Jan 2003 04:37:06 -  1.76
  @@ -118,8 +118,10 @@
   
   sub httpd_conf {
   shift;
  -my $err = (Apache->request || Apache->server)->
  -  add_config([split /\n/, join '', @_]);
  +my $obj;
  +eval { $obj = Apache->request };
  +$obj = Apache->server if $@;
  +my $err = $obj->add_config([split /\n/, join '', @_]);
   die $err if $err;
   }
   
  
  
  
  1.4   +2 -1  modperl-2.0/t/response/TestAPI/r_subclass.pm
  
  Index: r_subclass.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/r_subclass.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- r_subclass.pm 22 May 2002 18:53:33 -  1.3
  +++ r_subclass.pm 31 Jan 2003 04:37:07 -  1.4
  @@ -23,7 +23,8 @@
   
   plan $r, tests => 5;
   
  -ok ! Apache->request;
  +eval { Apache->request; };
  +ok $@;
   
   ok $r->uri eq $location;
   
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-30 Thread stas
stas2003/01/30 20:20:20

  Modified:src/modules/perl modperl_global.c modperl_global.h
   xs/Apache/RequestUtil Apache__RequestUtil.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  expose modperl_global_request (needed in external apps written in XS )
  
  Revision  ChangesPath
  1.7   +24 -0 modperl-2.0/src/modules/perl/modperl_global.c
  
  Index: modperl_global.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_global.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- modperl_global.c  22 May 2002 18:53:33 -  1.6
  +++ modperl_global.c  31 Jan 2003 04:20:20 -  1.7
  @@ -26,6 +26,30 @@
   MpReqSET_GLOBAL_REQUEST_On(rcfg);
   }
   
  +/* get/set */
  +request_rec *modperl_global_request(pTHX_ SV *svr)
  +{
  +request_rec *cur = NULL;
  +apr_status_t status = modperl_tls_get_request_rec(&cur);
  +
  +if (status != APR_SUCCESS) {
  +/* an internal problem */
  +Perl_croak(aTHX_ "failed to retrieve the request object");
  +}
  +
  +if (!cur) {
  +/* wrong configuration */
  +Perl_croak(aTHX_ "Global $r object is not available. Set:\n"
  +   "\tPerlOptions +GlobalRequest\nin httpd.conf");
  +}
  +
  +if (svr) {
  +modperl_global_request_obj_set(aTHX_ svr);
  +}
  +
  +return cur;
  +}
  +
   void modperl_global_request_obj_set(pTHX_ SV *svr)
   {
   /* XXX: support sublassing */
  
  
  
  1.4   +2 -0  modperl-2.0/src/modules/perl/modperl_global.h
  
  Index: modperl_global.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_global.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_global.h  4 May 2001 05:49:19 -   1.3
  +++ modperl_global.h  31 Jan 2003 04:20:20 -  1.4
  @@ -18,6 +18,8 @@
   
   void modperl_global_request_cfg_set(request_rec *r);
   
  +request_rec *modperl_global_request(pTHX_ SV *svr);
  +
   void modperl_global_request_set(request_rec *r);
   
   void modperl_global_request_obj_set(pTHX_ SV *svr);
  
  
  
  1.17  +2 -19 modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
  
  Index: Apache__RequestUtil.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Apache__RequestUtil.h 31 Jan 2003 03:15:23 -  1.16
  +++ Apache__RequestUtil.h 31 Jan 2003 04:20:20 -  1.17
  @@ -85,25 +85,8 @@
   static MP_INLINE
   request_rec *mpxs_Apache_request(pTHX_ SV *classname, SV *svr)
   {
  -request_rec *cur = NULL;
  -apr_status_t status = modperl_tls_get_request_rec(&cur);
  -
  -if (status != APR_SUCCESS) {
  -/* an internal problem */
  -Perl_croak(aTHX_ "failed to retrieve the request object");
  -}
  -
  -if (!cur) {
  -/* wrong configuration */
  -Perl_croak(aTHX_ "Global $r object is not available. Set:\n"
  -   "\tPerlOptions +GlobalRequest\nin httpd.conf");
  -}
  -
  -if (svr) {
  -modperl_global_request_obj_set(aTHX_ svr);
  -}
  -
  -return cur;
  +/* ignore classname */
  +return modperl_global_request(aTHX_ svr);
   }
   
   static MP_INLINE
  
  
  
  1.104 +14 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- FunctionTable.pm  29 Jan 2003 03:56:00 -  1.103
  +++ FunctionTable.pm  31 Jan 2003 04:20:20 -  1.104
  @@ -1494,6 +1494,20 @@
   'args' => []
 },
 {
  +'return_type' => 'request_rec *',
  +'name' => 'modperl_global_request',
  +'args' => [
  +  {
  +'type' => 'PerlInterpreter *',
  +'name' => 'my_perl'
  +  },
  +  {
  +'type' => 'SV *',
  +'name' => 'svr'
  +  }
  +]
  +  },
  +  {
   'return_type' => 'SV *',
   'name' => 'modperl_dir_config',
   'attr' => [
  
  
  



cvs commit: modperl-2.0 Changes

2003-01-30 Thread stas
stas2003/01/30 19:15:24

  Modified:xs/Apache/RequestUtil Apache__RequestUtil.h
   .Changes
  Added:   t/response/TestError api.pm
  Log:
  die when Apache->request returns nothing ('PerlOptions -GlobalRequest'
  or 'SetHandler modperl'
  
  Revision  ChangesPath
  1.16  +8 -1  modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
  
  Index: Apache__RequestUtil.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Apache__RequestUtil.h 11 Jan 2003 00:02:16 -  1.15
  +++ Apache__RequestUtil.h 31 Jan 2003 03:15:23 -  1.16
  @@ -89,9 +89,16 @@
   apr_status_t status = modperl_tls_get_request_rec(&cur);
   
   if (status != APR_SUCCESS) {
  -/* XXX: croak */
  +/* an internal problem */
  +Perl_croak(aTHX_ "failed to retrieve the request object");
   }
   
  +if (!cur) {
  +/* wrong configuration */
  +Perl_croak(aTHX_ "Global $r object is not available. Set:\n"
  +   "\tPerlOptions +GlobalRequest\nin httpd.conf");
  +}
  +
   if (svr) {
   modperl_global_request_obj_set(aTHX_ svr);
   }
  
  
  
  1.1  modperl-2.0/t/response/TestError/api.pm
  
  Index: api.pm
  ===
  package TestError::api;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile => qw(OK);
  
  sub handler {
  my $r = shift;
  
  plan $r, tests => 1;
  
  $r->content_type('text/plain');
  
  # PerlOptions -GlobalRequest is in effect
  eval { Apache->request; };
  ok t_cmp(qr/\$r object is not available/,
  $@, "unavailable global $r object");
  
  return Apache::OK;
  }
  
  1;
  __END__
  PerlOptions -GlobalRequest
  
  
  
  1.118 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- Changes   29 Jan 2003 03:56:00 -  1.117
  +++ Changes   31 Jan 2003 03:15:24 -  1.118
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +die when Apache->request returns nothing ('PerlOptions -GlobalRequest'
  +or 'SetHandler modperl' [Stas]
  +
   New Apache::Directive methods: as_hash(), lookup() + tests + docs
   [Philippe M. Chiasson <[EMAIL PROTECTED]>]
   
  
  
  



cvs commit: modperl-2.0 Makefile.PL

2003-01-30 Thread stas
stas2003/01/30 16:52:22

  Modified:.Makefile.PL
  Log:
  use a portable $(MAKE) instead of just 'make'
  
  Revision  ChangesPath
  1.91  +1 -1  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- Makefile.PL   23 Jan 2003 05:16:30 -  1.90
  +++ Makefile.PL   31 Jan 2003 00:52:21 -  1.91
  @@ -460,7 +460,7 @@
$(PASSENV) \
$(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
t/TEST
  - cd ModPerl-Registry && make test
  + cd ModPerl-Registry && $(MAKE) test
   
   test :: pure_all run_tests test_clean
   EOF