perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/xs/maps modperl_functions.map
Date Thu, 16 Sep 2004 16:36:29 GMT
stas        2004/09/16 09:36:29

  Modified:    .        Changes
               lib/Apache compat.pm
               src/modules/perl modperl_util.c
               t/response/TestAPI aplog.pm
               t/response/TestCompat apache.pm
               t/response/TestVhost log.pm
               xs/Apache/Log Apache__Log.h
               xs/maps  modperl_functions.map
  Log:
  Apache::Log changes: [Stas]
    - moved to compat: Apache::warn, Apache->warn, Apache::Server->warn,
      Apache::Server::warn
    - re-enabled $r->warn
    - removed support for Apache::ServerRec->warn
      (Apache::ServerRec::warn is still there)
  
  Revision  Changes    Path
  1.485     +7 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.484
  retrieving revision 1.485
  diff -u -u -r1.484 -r1.485
  --- Changes	14 Sep 2004 17:48:15 -0000	1.484
  +++ Changes	16 Sep 2004 16:36:28 -0000	1.485
  @@ -12,6 +12,13 @@
   
   =item 1.99_17-dev
   
  +Apache::Log changes: [Stas]
  +  - moved to compat: Apache::warn, Apache->warn, Apache::Server->warn,
  +    Apache::Server::warn
  +  - re-enabled $r->warn
  +  - removed support for Apache::ServerRec->warn
  +    (Apache::ServerRec::warn is still there)
  +
   Apache::Directive conftree() changed from class method to
   regular subroutine [Gozer]
   
  
  
  
  1.122     +11 -1     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.121
  retrieving revision 1.122
  diff -u -u -r1.121 -r1.122
  --- compat.pm	14 Sep 2004 00:08:27 -0000	1.121
  +++ compat.pm	16 Sep 2004 16:36:28 -0000	1.122
  @@ -286,6 +286,11 @@
   
   our $AddPerlVersion = 1;
   
  +sub warn {
  +    shift if @_ and $_[0] eq 'Apache::Server';
  +    Apache::ServerRec::warn(@_);
  +}
  +
   package Apache;
   
   sub server_root_relative {
  @@ -343,6 +348,11 @@
       Apache->server->log_error(@_);
   }
   
  +sub warn {
  +    shift if @_ and $_[0] eq 'Apache';
  +    Apache::ServerRec::warn(@_);
  +}
  +
   sub httpd_conf {
       shift;
       my $obj;
  @@ -452,7 +462,7 @@
       }
       else {
           my $name = (caller(1))[3];
  -        warn "Usage: \$r->$name([key [,val]])";
  +        $r->warn("Usage: \$r->$name([key [,val]])");
       }
   }
   
  
  
  
  1.83      +8 -6      modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -u -r1.82 -r1.83
  --- modperl_util.c	10 Sep 2004 00:54:54 -0000	1.82
  +++ modperl_util.c	16 Sep 2004 16:36:29 -0000	1.83
  @@ -85,6 +85,12 @@
       return SvROK(sv) ? SvRV(sv) : sv;
   }
   
  +
  +/* notice that if sv is not an Apache::ServerRec object and
  + * Apache->request is not available, the returned global object might
  + * be not thread-safe under threaded mpms, so use with care
  + */
  + 
   MP_INLINE server_rec *modperl_sv2server_rec(pTHX_ SV *sv)
   {
       if (SvOBJECT(sv) || (SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG))) {
  @@ -100,7 +106,6 @@
           }
       }
       
  -    MP_CROAK_IF_THREADS_STARTED("using global server object");
       /* modperl_global_get_server_rec is not thread safe w/o locking */
       return modperl_global_get_server_rec();
   }
  @@ -131,15 +136,12 @@
           }
       }
   
  -    if (!sv) {
  +    /* might be Apache::ServerRec::warn method */
  +    if (!sv && !(classname && SvPOK(in) && !strEQ(classname, SvPVX(in))))
{
           request_rec *r = NULL;
           (void)modperl_tls_get_request_rec(&r);
   
           if (!r) {
  -            if (classname && SvPOK(in) && !strEQ(classname, SvPVX(in)))
{
  -                /* might be Apache::{ServerRec,RequestRec}-> dual method */
  -                return NULL;
  -            }
               Perl_croak(aTHX_
                          "Apache->%s called without setting Apache->request!",
                          cv ? GvNAME(CvGV(cv)) : "unknown");
  
  
  
  1.18      +17 -1     modperl-2.0/t/response/TestAPI/aplog.pm
  
  Index: aplog.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/aplog.pm,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -u -r1.17 -r1.18
  --- aplog.pm	10 Jul 2004 00:37:06 -0000	1.17
  +++ aplog.pm	16 Sep 2004 16:36:29 -0000	1.18
  @@ -6,7 +6,9 @@
   use Apache::Test;
   use Apache::TestUtil;
   
  +use Apache::ServerRec qw(warn); # override warn locally
   use Apache::RequestRec ();
  +use Apache::RequestUtil ();
   use Apache::Log ();
   use Apache::MPM ();
   
  @@ -80,8 +82,22 @@
           ok 1;
       }
   
  -    Apache->warn("Apache->warn test ok");
  +    t_server_log_warn_is_expected();
       $s->warn('$s->warn test ok');
  +
  +    {
  +        t_server_log_warn_is_expected();
  +        # this uses global server to get $s internally
  +        Apache::ServerRec::warn("Apache::ServerRec::warn test ok");
  +
  +        Apache->request($r);
  +        t_server_log_warn_is_expected();
  +        # this uses the global $r to get $s internally
  +        Apache::ServerRec::warn("Apache::ServerRec::warn test ok");
  +    }
  +
  +    t_server_log_warn_is_expected();
  +    warn "warn test ok";
   
       Apache::OK;
   }
  
  
  
  1.20      +19 -2     modperl-2.0/t/response/TestCompat/apache.pm
  
  Index: apache.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache.pm,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -u -r1.19 -r1.20
  --- apache.pm	26 Aug 2004 00:00:33 -0000	1.19
  +++ apache.pm	16 Sep 2004 16:36:29 -0000	1.20
  @@ -9,16 +9,17 @@
   
   use Apache::TestUtil;
   use Apache::Test;
  -use File::Spec::Functions qw(catfile canonpath);
   
   use ModPerl::Util ();
   use Apache::compat ();
   use Apache::Constants qw(DIR_MAGIC_TYPE :common :response);
   
  +use File::Spec::Functions qw(catfile canonpath);
  +
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 17;
  +    plan $r, tests => 21;
   
       $r->send_http_header('text/plain');
   
  @@ -42,6 +43,22 @@
   
       t_server_log_error_is_expected();
       Apache::log_error("Apache::log_error test ok");
  +    ok 1;
  +
  +    t_server_log_warn_is_expected();
  +    Apache->warn('Apache->warn ok');
  +    ok 1;
  +
  +    t_server_log_warn_is_expected();
  +    Apache::warn('Apache::warn ok');
  +    ok 1;
  +
  +    t_server_log_warn_is_expected();
  +    Apache::Server->warn('Apache::Server->warn ok');
  +    ok 1;
  +
  +    t_server_log_warn_is_expected();
  +    Apache::Server::warn('Apache::Server::warn ok');
       ok 1;
   
       # explicitly imported
  
  
  
  1.4       +1 -3      modperl-2.0/t/response/TestVhost/log.pm
  
  Index: log.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestVhost/log.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- log.pm	10 Sep 2004 00:49:25 -0000	1.3
  +++ log.pm	16 Sep 2004 16:36:29 -0000	1.4
  @@ -22,16 +22,14 @@
   my @methods1 = (
       '$r->log->warn',
       '$r->log_error',
  +    '$r->warn',
       '$s->log->warn',
       '$s->log_error',
       '$s->warn',
   );
   
   my @methods2 = (
  -    'Apache->warn',
  -    'Apache::ServerRec->warn',
       'Apache::ServerRec::warn',
  -    'Apache::warn',
       'warn',
   );
   
  
  
  
  1.21      +13 -24    modperl-2.0/xs/Apache/Log/Apache__Log.h
  
  Index: Apache__Log.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Log/Apache__Log.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -u -r1.20 -r1.21
  --- Apache__Log.h	10 Sep 2004 00:54:55 -0000	1.20
  +++ Apache__Log.h	16 Sep 2004 16:36:29 -0000	1.21
  @@ -44,7 +44,6 @@
           s = (server_rec *)SvObjIV(sv);
       }
       else {
  -        MP_CROAK_IF_THREADS_STARTED("using global server object");
           s = modperl_global_get_server_rec();
       }
   
  @@ -269,6 +268,14 @@
       XSRETURN_EMPTY;
   }
   
  +/*
  + * this function handles:
  + * $r->log_error
  + * $s->log_error
  + * $r->warn
  + * $s->warn
  + * Apache::ServerRec::warn
  + */
   static XS(MPXS_Apache__Log_log_error)
   {
       dXSARGS;
  @@ -279,33 +286,16 @@
       SV *sv = Nullsv;
       STRLEN n_a;
   
  -    /*
  -     * we support the following:
  -     * Apache::warn
  -     * Apache->warn
  -     * Apache::ServerRec->log_error
  -     * Apache::ServerRec->warn
  -     * $r->log_error
  -     * $r->warn
  -     * $s->log_error
  -     * $s->warn
  -     */
  -
       if (items > 1) {
  -        if ((r = modperl_xs_sv2request_rec(aTHX_ ST(0),
  -                                           "Apache::RequestRec", cv)))
  -        {
  -            s = r->server;
  -        }
  -        else if (sv_isa(ST(0), "Apache::ServerRec")) {
  +        if (sv_isa(ST(0), "Apache::ServerRec")) {
               s = (server_rec *)SvObjIV(ST(0));
           }
  -        else if (SvPOK(ST(0)) && strEQ(SvPVX(ST(0)), "Apache::ServerRec")) {
  -            MP_CROAK_IF_THREADS_STARTED("using global server object");
  -            s = modperl_global_get_server_rec();
  +        else if ((r = modperl_xs_sv2request_rec(aTHX_ ST(0),
  +                                                "Apache::RequestRec", cv))) {
  +            s = r->server;
           }
       }
  -              
  +
       if (s) {
           i = 1;
       }
  @@ -316,7 +306,6 @@
               s = r->server;
           }
           else {
  -            MP_CROAK_IF_THREADS_STARTED("using global server object");
               s = modperl_global_get_server_rec();
           }
       }
  
  
  
  1.88      +1 -3      modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -u -r1.87 -r1.88
  --- modperl_functions.map	9 Sep 2004 22:39:11 -0000	1.87
  +++ modperl_functions.map	16 Sep 2004 16:36:29 -0000	1.88
  @@ -123,15 +123,13 @@
   SV *:DEFINE_log   | | SV *:obj
   DEFINE_log_rerror | MPXS_Apache__Log_log_xerror | ...
   DEFINE_log_error  | MPXS_Apache__Log_log_error  | ...
  +DEFINE_warn       | MPXS_Apache__Log_log_error  | ...
   
   PACKAGE=Apache::ServerRec
   SV *:DEFINE_log   | | SV *:obj
   DEFINE_log_serror | MPXS_Apache__Log_log_xerror | ...
   DEFINE_log_error  | MPXS_Apache__Log_log_error  | ...
   DEFINE_warn       | MPXS_Apache__Log_log_error  | ...
  -
  -PACKAGE=Apache
  -DEFINE_warn       | MPXS_Apache__Log_log_error | ...
   
   MODULE=Apache::SubProcess   PACKAGE=Apache::RequestRec
    # ap_subprocess_ won't work
  
  
  

Mime
View raw message