You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@hyperreal.org on 1998/11/20 05:16:15 UTC

cvs commit: modperl/t/net/perl api.pl constants.pl test

dougm       98/11/19 20:16:14

  Modified:    .        Changes ToDo
               Constants Constants.pm
               lib/Apache/Constants Exports.pm
               src/modules/perl Apache.xs Exports.c mod_perl.c
                        perl_config.c
               t/docs   startup.pl
               t/net/perl api.pl constants.pl test
  Log:
  some Apache::Constants updates (see the .pod) and new export() method
  
  Revision  Changes    Path
  1.203     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.202
  retrieving revision 1.203
  diff -u -r1.202 -r1.203
  --- Changes	1998/11/19 17:00:43	1.202
  +++ Changes	1998/11/20 04:15:56	1.203
  @@ -8,6 +8,8 @@
   
   =item 1.16_01-dev
   
  +some Apache::Constants updates (see the .pod) and new export() method
  +
   ensure @INC value from startup time is always properly saved
   
   pod support '=for apache/=end apache' replaced with:
  
  
  
  1.119     +2 -0      modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /export/home/cvs/modperl/ToDo,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- ToDo	1998/11/19 16:51:53	1.118
  +++ ToDo	1998/11/20 04:15:57	1.119
  @@ -3,6 +3,8 @@
                    (well, close to it anyhow)
   ---------------------------------------------------------------------------
   
  +- sort out early startup/auto pre-load Apache/@INC issues
  +
   - stronghold patches [Todd R. Eigenschink <to...@tekinteractive.com>]
   
   - <Perl>/%Apache::ReadConfig:: brokeness (My::configure() example, Eric Cholet)
  
  
  
  1.15      +63 -8     modperl/Constants/Constants.pm
  
  Index: Constants.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/Constants/Constants.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Constants.pm	1998/11/12 16:12:08	1.14
  +++ Constants.pm	1998/11/20 04:16:05	1.15
  @@ -25,6 +25,17 @@
   
   my %ConstNameCache = ();
   
  +sub export {
  +    my $class = shift;
  +    for my $new (@_) {
  +	next if grep { $new eq $_ } @Apache::Constants::EXPORT_OK;
  +	push @Apache::Constants::EXPORT_OK, $new;
  +	if(defined %Apache::Constants::EXPORT) {
  +	    $Apache::Constants::EXPORT{$new} = 1;
  +	}
  +    }
  +}
  +
   sub name {
       my($self, $const) = @_;
       require Apache::Constants::Exports;
  @@ -156,15 +167,17 @@
   (NOTE: not all implemented here)
   
    HTTP_OK
  - HTTP_METHOD_NOT_ALLOWED
  - HTTP_NOT_ACCEPTABLE
  - HTTP_LENGTH_REQUIRED
  - HTTP_PRECONDITION_FAILED
  - HTTP_SERVICE_UNAVAILABLE
  - HTTP_VARIANT_ALSO_VARIES
  - HTTP_NO_CONTENT
  + HTTP_MOVED_TEMPORARILY
  + HTTP_MOVED_PERMANENTLY
  + HTTP_METHOD_NOT_ALLOWED 
    HTTP_NOT_MODIFIED
  - HTTP_LENGTH_REQUIRED
  + HTTP_UNAUTHORIZED
  + HTTP_FORBIDDEN
  + HTTP_NOT_FOUND
  + HTTP_BAD_REQUEST
  + HTTP_INTERNAL_SERVER_ERROR
  + HTTP_NOT_ACCEPTABLE 
  + HTTP_NO_CONTENT
    HTTP_PRECONDITION_FAILED
    HTTP_SERVICE_UNAVAILABLE
    HTTP_VARIANT_ALSO_VARIES
  @@ -176,6 +189,48 @@
    MODULE_MAGIC_NUMBER
    SERVER_VERSION
    SERVER_BUILT
  +
  +=item config
  +
  +These are constants related to configuration directives:
  +
  + DECLINE_CMD
  +
  +=item types
  +
  +These are constants related to internal request types:
  +
  + DIR_MAGIC_TYPE
  +
  +=item override
  +
  +These constants are used to control and test the context of configuration
  +directives.
  +
  + OR_NONE
  + OR_LIMIT
  + OR_OPTIONS
  + OR_FILEINFO
  + OR_AUTHCFG
  + OR_INDEXES
  + OR_UNSET
  + OR_ALL
  + ACCESS_CONF
  + RSRC_CONF
  +
  +=item args_how
  +
  + RAW_ARGS
  + TAKE1
  + TAKE2
  + TAKE12
  + TAKE3
  + TAKE23
  + TAKE123
  + ITERATE
  + ITERATE2
  + FLAG
  + NO_ARGS
   
   =back
   
  
  
  
  1.8       +8 -6      modperl/lib/Apache/Constants/Exports.pm
  
  Index: Exports.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/lib/Apache/Constants/Exports.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Exports.pm	1998/11/12 16:12:09	1.7
  +++ Exports.pm	1998/11/20 04:16:06	1.8
  @@ -25,15 +25,17 @@
   my(@remotehost) = qw(REMOTE_HOST REMOTE_NAME
   		     REMOTE_NOLOOKUP REMOTE_DOUBLE_REV);
   my(@http)       = qw(HTTP_OK
  +		     HTTP_MOVED_TEMPORARILY
  +		     HTTP_MOVED_PERMANENTLY
   		     HTTP_METHOD_NOT_ALLOWED 
  +		     HTTP_NOT_MODIFIED
  +		     HTTP_UNAUTHORIZED
  +		     HTTP_FORBIDDEN
  +		     HTTP_NOT_FOUND
  +		     HTTP_BAD_REQUEST
  +		     HTTP_INTERNAL_SERVER_ERROR
   		     HTTP_NOT_ACCEPTABLE 
  -		     HTTP_LENGTH_REQUIRED
  -		     HTTP_PRECONDITION_FAILED
  -		     HTTP_SERVICE_UNAVAILABLE
  -		     HTTP_VARIANT_ALSO_VARIES
   		     HTTP_NO_CONTENT
  -		     HTTP_NOT_MODIFIED
  -		     HTTP_LENGTH_REQUIRED
   		     HTTP_PRECONDITION_FAILED
   		     HTTP_SERVICE_UNAVAILABLE
   		     HTTP_VARIANT_ALSO_VARIES);
  
  
  
  1.65      +1 -1      modperl/src/modules/perl/Apache.xs
  
  Index: Apache.xs
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/Apache.xs,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- Apache.xs	1998/11/19 04:33:35	1.64
  +++ Apache.xs	1998/11/20 04:16:07	1.65
  @@ -278,7 +278,7 @@
       (r->hostname ? r->hostname : r->server->server_hostname) 
   #endif
   
  -#if MODULE_MAGIC_NUMBER >= MMN_131
  +#if(MODULE_MAGIC_NUMBER >= MMN_131) && !defined(WIN32)
   static int mod_perl_define(SV *sv, char *name)
   {
       char **defines;
  
  
  
  1.6       +8 -6      modperl/src/modules/perl/Exports.c
  
  Index: Exports.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/Exports.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Exports.c	1998/11/12 16:12:09	1.5
  +++ Exports.c	1998/11/20 04:16:08	1.6
  @@ -16,15 +16,17 @@
   };
   static char *ETAG_http[] = { 
      "HTTP_OK",
  +   "HTTP_MOVED_TEMPORARILY",
  +   "HTTP_MOVED_PERMANENTLY",
      "HTTP_METHOD_NOT_ALLOWED",
  +   "HTTP_NOT_MODIFIED",
  +   "HTTP_UNAUTHORIZED",
  +   "HTTP_FORBIDDEN",
  +   "HTTP_NOT_FOUND",
  +   "HTTP_BAD_REQUEST",
  +   "HTTP_INTERNAL_SERVER_ERROR",
      "HTTP_NOT_ACCEPTABLE",
  -   "HTTP_LENGTH_REQUIRED",
  -   "HTTP_PRECONDITION_FAILED",
  -   "HTTP_SERVICE_UNAVAILABLE",
  -   "HTTP_VARIANT_ALSO_VARIES",
      "HTTP_NO_CONTENT",
  -   "HTTP_NOT_MODIFIED",
  -   "HTTP_LENGTH_REQUIRED",
      "HTTP_PRECONDITION_FAILED",
      "HTTP_SERVICE_UNAVAILABLE",
      "HTTP_VARIANT_ALSO_VARIES",
  
  
  
  1.57      +8 -1      modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- mod_perl.c	1998/11/19 17:00:48	1.56
  +++ mod_perl.c	1998/11/20 04:16:08	1.57
  @@ -436,6 +436,7 @@
   static void mp_server_notstarting(void *data) 
   {
       saveINC;
  +    perl_require_module("Apache", NULL); 
       Apache__ServerStarting(FALSE);
   }
   
  @@ -450,6 +451,7 @@
       I32 i;
       SV *namesv;
       SV *version = perl_get_sv("Apache::VERSION", FALSE);
  +
       if(!version)
   	croak("Apache.pm failed to load!"); /*should never happen*/
       if(SvNV(version) >= MP_APACHE_VERSION) /*no worries*/
  @@ -522,6 +524,11 @@
       dstr = NULL;
   #endif
   
  +    if(PERL_RUNNING()) {
  +	saveINC;
  +	mp_check_version();
  +    }
  +    
       if(perl_is_running == 0) {
   	/* we'll boot Perl below */
       }
  @@ -685,7 +692,7 @@
   	    exit(1);
   	}
       }
  -    mp_check_version();
  +
       LEAVE_SAFE;
   
       MP_TRACE_g(fprintf(stderr, 
  
  
  
  1.49      +2 -3      modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- perl_config.c	1998/11/19 16:52:14	1.48
  +++ perl_config.c	1998/11/20 04:16:08	1.49
  @@ -330,8 +330,6 @@
       PERL_CHILD_EXIT_CREATE(cls);
       PERL_RESTART_CREATE(cls);
       PERL_INIT_CREATE(cls);
  -    new = (char **)push_array(cls->PerlModule);
  -    *new = pstrdup(p, "Apache");
   
       return (void *)cls;
   }
  @@ -389,6 +387,7 @@
   #define PERL_CMD_PUSH_HANDLERS(hook, cmd) \
   if(!PERL_RUNNING()) { \
       perl_startup(parms->server, parms->pool); \
  +    perl_require_module("Apache", parms->server); \
       MP_TRACE_g(fprintf(stderr, "mod_perl: %s calling perl_startup()\n", __FUNCTION__)); \
   } \
   return perl_cmd_push_handlers(hook,&cmd,arg,parms->pool)
  @@ -510,7 +509,7 @@
   {
       dPSRV(parms->server);
       if(!PERL_RUNNING()) perl_startup(parms->server, parms->pool); 
  -
  +    perl_require_module("Apache", parms->server); 
       if(PERL_RUNNING()) 
   	perl_require_module(arg, parms->server);
       else {
  
  
  
  1.26      +5 -0      modperl/t/docs/startup.pl
  
  Index: startup.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/docs/startup.pl,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- startup.pl	1998/11/19 04:33:38	1.25
  +++ startup.pl	1998/11/20 04:16:12	1.26
  @@ -20,6 +20,11 @@
   
   use Apache ();
   use Apache::Registry ();
  +unless ($INC{'Apache.pm'} =~ /blib/) {
  +    die "Wrong Apache.pm loaded: $INC{'Apache.pm'}";
  +}
  +
  +Apache::Constants->export(qw(HTTP_MULTIPLE_CHOICES));
   
   #no mod_perl qw(Connection Server);
   
  
  
  
  1.33      +8 -3      modperl/t/net/perl/api.pl
  
  Index: api.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/net/perl/api.pl,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- api.pl	1998/11/19 04:33:38	1.32
  +++ api.pl	1998/11/20 04:16:12	1.33
  @@ -16,7 +16,7 @@
   
   my $is_xs = ($r->uri =~ /_xs/);
   
  -my $tests = 53;
  +my $tests = 51;
   my $is_win32 = WIN32;
   $tests += 2 unless $is_win32;
   my $test_get_set = Apache->can('set_handlers') && ($tests += 4);
  @@ -49,8 +49,13 @@
   test ++$i, -d $Apache::Server::CWD;
   print "\$Apache::Server::CWD == $Apache::Server::CWD\n";
   print "\$0 == $0\n";
  -test ++$i, not $Apache::Server::Starting;
  -test ++$i, not $Apache::Server::ReStarting;
  +
  +if($Apache::Server::Starting) {
  +    warn "Apache::ServerStarting var is broken\n";
  +}
  +if($Apache::Server::ReStarting) {
  +    warn "Apache::ReServerStarting var is broken\n";
  +}
   
   unless ($is_win32) {
     my $ft_s = -s $INC{'Apache.pm'};
  
  
  
  1.9       +11 -2     modperl/t/net/perl/constants.pl
  
  Index: constants.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/net/perl/constants.pl,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- constants.pl	1998/11/12 16:12:10	1.8
  +++ constants.pl	1998/11/20 04:16:13	1.9
  @@ -7,7 +7,7 @@
   # (It may become useful if the test is moved to ./t subdirectory.)
   
   eval { require Apache::Constants::Exports };
  -
  +Apache::Constants->export(qw(HTTP_MULTIPLE_CHOICES));
   use Apache::Constants qw(MODULE_MAGIC_NUMBER);
   use strict qw(vars);
   shift->send_http_header("text/plain");
  @@ -28,6 +28,10 @@
   }
   
   push @export, grep {!$SEEN{$_}++} @Apache::Constants::EXPORT;
  +for my $sym (@Apache::Constants::EXPORT_OK) {
  +    next if $SEEN{$sym}++;
  +    Apache::Constants->import($sym) unless defined &$sym;
  +}
   
   #skip some 1.3 stuff that 1.2 didn't have
   my %skip = map { $_,1 } qw(DONE REMOTE_DOUBLE_REV DECLINE_CMD DIR_MAGIC_TYPE
  @@ -42,6 +46,8 @@
   }
   
   my $tests = (1 + @export) - keys %skip; 
  +$tests += 1; #extras
  +
   print "1..$tests\n"; 
   #$loaded = 1;
   print "ok 1\n";
  @@ -58,9 +64,12 @@
   	$name = Apache::Constants->name($val);
       };
       print defined $val ? "" : "not ", "ok $ix ($name|$sym: $val)\n";
  -    last if $ix >= $tests;
       $ix++;
  +    last if $ix >= $tests;
   }
  +
  +my $added = HTTP_MULTIPLE_CHOICES();
  +print defined $added ? "" : "not ", "ok $ix\n";
   
   ######################### End of black magic.
   
  
  
  
  1.13      +0 -2      modperl/t/net/perl/test
  
  Index: test
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/net/perl/test,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- test	1998/09/19 23:02:58	1.12
  +++ test	1998/11/20 04:16:13	1.13
  @@ -9,8 +9,6 @@
   
   not $filename or die "Apache::Registry scoping is broken!\n";
   
  -$Apache::ServerStarting and die "Apache::ServerStarting var is broken\n";
  -
   #make sure this untrip works
   if($USE_THREAD) {
       warn "must fix \$/ for threaded Perl\n";