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/06/07 19:58:52 UTC

cvs commit: modperl/t/net/perl tie_table.pl

dougm       98/06/07 10:58:51

  Modified:    .        Changes Makefile.PL ToDo apache-modlist.html
               Apache   typemap
               Tie      Tie.pm typemap
               src/modules/perl Tie.xs mod_perl.h perl_util.c
               t/net/perl tie_table.pl
  Log:
  add SSLCacheServer{Port,Path} directives for ApacheSSL + 'make test'
  [Adam Laurie <ad...@algroup.co.uk>]
  
  make $r->header_in->{get,set,etc}
  work just like
  (tied $r->header_in)->{get,set,etc}
  
  Revision  Changes    Path
  1.46      +3 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Changes	1998/06/05 02:08:09	1.45
  +++ Changes	1998/06/07 17:58:39	1.46
  @@ -22,6 +22,9 @@
   
   =item 1.11_01-dev
   
  +add SSLCacheServer{Port,Path} directives for ApacheSSL + 'make test'
  +[Adam Laurie <ad...@algroup.co.uk>]
  +
   added $r->location method
   
   Various fixes and improvements to the APACI support:
  
  
  
  1.37      +6 -1      modperl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /export/home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Makefile.PL	1998/06/04 15:16:07	1.36
  +++ Makefile.PL	1998/06/07 17:58:40	1.37
  @@ -118,6 +118,7 @@
   $PERL_DESTRUCT_LEVEL = "";
   $PERL_STATIC_EXTS = "";
   $PERL_EXTRA_CFLAGS = "";
  +$SSLCacheServerPort = 8539;
   $Port = 8529;
   $PORT ||= $Port;
   $DO_HTTPD = $ENV{DO_HTTPD} || 0;
  @@ -693,7 +694,11 @@
       for (qw(User Group)) {
   	iedit "t/conf/httpd.conf", "s/^$_ .*/$_ $$_/"; 
       }
  -    conf_append("SSLDisable") if $IsBenSSL;
  +    conf_append(<<EOF) if $IsBenSSL;
  +SSLDisable
  +SSLCacheServerPort $SSLCacheServerPort
  +SSLCacheServerPath /tmp  
  +EOF
       conf_append($StrongholdKey) if $StrongholdKey;
   
       #phooey!
  
  
  
  1.32      +0 -10     modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /export/home/cvs/modperl/ToDo,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ToDo	1998/06/03 20:57:09	1.31
  +++ ToDo	1998/06/07 17:58:41	1.32
  @@ -24,11 +24,6 @@
   - problems w/ CGI.pm 2.4x + modules/cgi 6-7
   	Ask Bjorn Hansen <as...@netcetera.dk>
   
  -- add directives for ApacheSSL + 'make test'
  - SSLCacheServerPort 30123
  - SSLCacheServerPath /tmp
  -	Adam Laurie <ad...@algroup.co.uk>
  -
   - Gerald's report of Embperl/sub-request/print breakage
   
   - perl-status?mod_perl_hooks broken under win32?
  @@ -37,11 +32,6 @@
              Jeff Baker <je...@godzilla.tamu.edu>
   
   - APACI stuff:
  -
  -  o is .xs.c target broken?  {Apache,Constants}.c is not being
  -    generated for some folks 
  -
  -  o building w/ threaded Perl
   
     o Support for the APXS variant of the new APACI stuff. Best would
       be a USE_APXS=1 similar to USE_APACI=1. The difference is that instead of
  
  
  
  1.18      +6 -2      modperl/apache-modlist.html
  
  Index: apache-modlist.html
  ===================================================================
  RCS file: /export/home/cvs/modperl/apache-modlist.html,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apache-modlist.html	1998/06/04 18:55:26	1.17
  +++ apache-modlist.html	1998/06/07 17:58:41	1.18
  @@ -1,13 +1,13 @@
   <html>
   <head>
   <title>The Apache/Perl Module List</title>
  -<!-- Changed by: Doug MacEachern,  4-Jun-1998 -->
  +<!-- Changed by: Doug MacEachern,  6-Jun-1998 -->
   </head>
   <body>
   <h1>The Apache/Perl Module List</h1>
   
   Maintained by <a href="mailto:dougm@osf.org">Doug MacEachern</a>,
  -<br><i> $Revision: 1.17 $ $Date: 1998/06/04 18:55:26 $</i>
  +<br><i> $Revision: 1.18 $ $Date: 1998/06/07 17:58:41 $</i>
   
   <h3>Contents</h3>
   <a href="#intro">Introduction</a><br>
  @@ -79,6 +79,7 @@
   OutputChain     bmpO	Chain output of stacked handlers	JANPAZ
   PassFile	bdpf	Send file via OutputChain		ANDK
   PerlRun		bmpf	Run unaltered CGI scripts		APML
  +RandomLocation	bdpf	Random image display 			MDARWIN
   Registry	Rmpf	Run unaltered CGI scripts 		APML
   RobotRules	bdpf	Enforce robot rules (robots.txt)	PARKER
   Sandwich	bmpf	Layered document (sandwich) maker	DOUGM
  @@ -137,6 +138,7 @@
   Timeit		bmpf	Benchmark PerlHandlers			APML
   
   * PerlLogHandler's
  +DBILogConfig	bdpf	Custom format logging via DBI		JBODNAR
   DBILogger	bdpf	Logging via DBI				ABH
   DumpHeaders	bdpf	Watch HTTP transaction via headers	DOUGM
   Traffic		bdpf	Logs bytes transferred, per-user basis 	MAURICE
  @@ -229,6 +231,7 @@
   IKLUFT	 Ian Kluft &lt;ikluft@cisco.com&gt;
   JANPAZ	 Honza Pazdziora &lt;adelton@informatics.muni.cz&gt;
   JBAKER   Jeffrey Baker &lt;jeff@godzilla.tamu.edu&gt;
  +JBODNAR	 Jason Bodnar &lt;jcbodnar@mail.utexas.edu&gt;
   JGROV	 John D Groenveld &lt;jdg117@elvis.arl.psu.edu&gt;
   JROWE	 Jeff Rowe &lt;beowulf@lava.net&gt;
   KWILLIAM Ken Williams  &lt;ken@forum.swarthmore.edu&gt;
  @@ -237,6 +240,7 @@
   MARKIM	 Mark A. Imbriaco &lt;mark@itribe.net&gt;
   MARKK	 Mark Kennedy &lt;mtk@ny.ubs.com&gt;
   MAURICE	 Maurice Aubrey &lt;maurice@hevanet.com&gt
  +MDARWIN	 Matthew Darwin &lt;matthew@davin.ottawa.on.ca&gt;
   MDORMAN	 Michael Alan Dorman  &lt;mdorman@calder.med.miami.edu&gt;
   MERGL	 Edmund Mergl &lt;E.Mergl@bawue.de&gt;
   MJS      Michael Smith &lt;mjs@iii.co.uk&gt;
  
  
  
  1.6       +7 -1      modperl/Apache/typemap
  
  Index: typemap
  ===================================================================
  RCS file: /export/home/cvs/modperl/Apache/typemap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- typemap	1998/05/14 03:06:53	1.5
  +++ typemap	1998/06/07 17:58:47	1.6
  @@ -6,7 +6,7 @@
   Apache::Server		T_PTROBJ
   Apache::ModuleConfig    T_PTROBJ
   Apache::Table		T_PTROBJ
  -Apache::TieHashTable	T_PTROBJ
  +Apache::TieHashTable	T_TABLEOBJ
   pid_t			T_IV
   Apache::Scoreboard      O_HvRV
   
  @@ -41,6 +41,9 @@
   T_APACHEOBJ
   	sv_setref_pv($arg, \"${ntype}\", (void*)$var);
   
  +T_TABLEOBJ
  +	sv_setref_pv($arg, \"${ntype}\", (void*)$var);
  +
   T_PV_CONST
   	SvREADONLY_on((SV*)$arg);
   	sv_setpv((SV*)$arg, (char *)$var);
  @@ -77,6 +80,9 @@
   
   T_APACHEOBJ
   	r = sv2request_rec($arg, \"$ntype\", cv)
  +
  +T_TABLEOBJ
  +	$var = ($type)hvrv2table($arg)
   
   T_PV_CONST
   	$var = ($type)SvPV($arg,na)
  
  
  
  1.2       +5 -3      modperl/Tie/Tie.pm
  
  Index: Tie.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/Tie/Tie.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Tie.pm	1998/05/14 02:58:23	1.1
  +++ Tie.pm	1998/06/07 17:58:49	1.2
  @@ -9,6 +9,7 @@
   if($ENV{MOD_PERL}) {
       __PACKAGE__->bootstrap($VERSION);
   }
  +*DESTROY = \&destroy; #avoid weird xsubpp bug
   
   1;
   
  @@ -25,7 +26,7 @@
       ...
       }
   
  -    my $table = tied %$headers_out;
  +    my $table = $r->headers_out;
       $table->set(From => 'dougm@perl.apache.org');
   
   =head1 DESCRIPTION
  @@ -41,8 +42,9 @@
   The I<Apache::TieHashTable> class provides methods for interfacing
   with the Apache C<table> structure.
   The following I<Apache> class methods, when called in a scalar context
  -with no "key" argument, will return a I<HASH> reference, 
  -where I<HASH> is tied to I<Apache::TieHashTable>:
  +with no "key" argument, will return a I<HASH> reference blessed into the
  +I<Apache::TieHashTable> class and where I<HASH> is tied to
  +I<Apache::TieHashTable>: 
   
    headers_in
    headers_out
  
  
  
  1.2       +13 -1     modperl/Tie/typemap
  
  Index: typemap
  ===================================================================
  RCS file: /export/home/cvs/modperl/Tie/typemap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- typemap	1998/05/14 02:58:23	1.1
  +++ typemap	1998/06/07 17:58:49	1.2
  @@ -1,3 +1,15 @@
   TYPEMAP
  -Apache::TieHashTable	T_PTROBJ
  +Apache::TieHashTable	T_TABLEOBJ
  +
  +OUTPUT
  +
  +T_TABLEOBJ
  +	sv_setref_pv($arg, \"${ntype}\", (void*)$var);
  +
  +INPUT
  +
  +T_TABLEOBJ
  +	$var = ($type)hvrv2table($arg);
  +
  +
   
  
  
  
  1.3       +1 -1      modperl/src/modules/perl/Tie.xs
  
  Index: Tie.xs
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/Tie.xs,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tie.xs	1998/05/17 23:31:53	1.2
  +++ Tie.xs	1998/06/07 17:58:50	1.3
  @@ -33,7 +33,7 @@
       RETVAL
   
   void
  -DESTROY(self)
  +destroy(self)
       Apache::TieHashTable self
   
       CODE:
  
  
  
  1.26      +2 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- mod_perl.h	1998/06/05 02:08:18	1.25
  +++ mod_perl.h	1998/06/07 17:58:50	1.26
  @@ -891,8 +891,10 @@
   
   SV *array_header2avrv(array_header *arr);
   array_header *avrv2array_header(SV *avrv, pool *p);
  +table *hvrv2table(SV *rv);
   SV *mod_perl_gensym (char *pack);
   SV *mod_perl_tie_table(table *t);
  +SV *perl_hvrv_magic_obj(SV *rv);
   void perl_tie_hash(HV *hv, char *class, SV *sv);
   void perl_util_cleanup(void);
   void mod_perl_clear_rgy_endav(request_rec *r, SV *sv);
  
  
  
  1.11      +23 -1     modperl/src/modules/perl/perl_util.c
  
  Index: perl_util.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/perl_util.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- perl_util.c	1998/06/03 17:05:31	1.10
  +++ perl_util.c	1998/06/07 17:58:50	1.11
  @@ -93,6 +93,16 @@
       return arr;
   }
   
  +table *hvrv2table(SV *rv)
  +{
  +    if(SvROK(rv) && SvTYPE(SvRV(rv)) == SVt_PVHV) {
  +	SV *sv = perl_hvrv_magic_obj(rv);
  +	if(!sv) croak("HV is not magic!");
  +	return (table *)SvIV((SV*)SvRV(sv));
  +    }
  +    return (table *)SvIV((SV*)SvRV(rv));
  +}
  +
   /* same as Symbol::gensym() */
   SV *mod_perl_gensym (char *pack)
   {
  @@ -111,8 +121,20 @@
       sv_setref_pv(sv, "Apache::Table", (void*)t);
       perl_qrequire_module("Apache::Tie");
       perl_tie_hash(hv, "Apache::TieHashTable", sv);
  -    return newRV_noinc((SV*)hv);
  +    return sv_bless(newRV_noinc((SV*)hv), 
  +		    gv_stashpv("Apache::TieHashTable", TRUE));
   }
  +
  +SV *perl_hvrv_magic_obj(SV *rv)
  +{
  +    HV *hv = (HV*)SvRV(rv); 
  +    MAGIC *mg;
  +    if(SvMAGICAL(hv) && (mg = mg_find((SV*)hv, 'P'))) 
  +        return mg->mg_obj;
  +    else
  +	return Nullsv;
  +}
  +
   
   void perl_tie_hash(HV *hv, char *class, SV *sv)
   {
  
  
  
  1.3       +9 -1      modperl/t/net/perl/tie_table.pl
  
  Index: tie_table.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/net/perl/tie_table.pl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- tie_table.pl	1998/05/17 23:31:56	1.2
  +++ tie_table.pl	1998/06/07 17:58:51	1.3
  @@ -6,7 +6,7 @@
   $r->send_http_header("text/plain");
   
   my $i = 0;
  -my $tests = 23;
  +my $tests = 26;
   print "1..$tests\n";
   
   my $headers_in = $r->headers_in;
  @@ -15,6 +15,7 @@
   test ++$i, UNIVERSAL::isa($headers_in, 'HASH');
   test ++$i, $table->isa('Apache::TieHashTable');
   test ++$i, $table->get('User-Agent');
  +test ++$i, $r->headers_in->get('User-Agent');
   test ++$i, $headers_in->{'User-Agent'};
   test ++$i, $table->get('User-Agent') eq $headers_in->{'User-Agent'};
   $table->merge(Accept => "application/x-perl");
  @@ -34,6 +35,13 @@
   test ++$i, scalar keys %$headers_in == 0;
   
   %$headers_in = %save;
  +
  +my %my_hash = (two => 2, three => 3);
  +@{ $r->notes }{ keys %my_hash } = (values %my_hash);
  +
  +for (keys %my_hash) {
  +    test ++$i, $r->notes->get($_);
  +}
   
   for my $meth (qw{
       headers_in headers_out err_headers_out notes dir_config subprocess_env