cvs commit: modperl-2.0/xs/maps modperl_functions.map

2003-02-17 Thread stas
stas2003/02/17 01:03:17

  Modified:.Changes
   lib/Apache compat.pm
   src/modules/perl modperl_callback.c modperl_callback.h
modperl_handler.c
   t/htdocs .cvsignore
   t/modperl .cvsignore
   t/response/TestCompat apache.pm
   todo api.txt
   xs/ModPerl/Util ModPerl__Util.h
   xs/maps  modperl_functions.map
  Added:   t/response/TestModperl current_callback.pm
  Log:
  - implement Apache::current_callback
  - $r-current_callback goes into Apache::compat, since now we have a way
too many callbacks unrelated to $r
  - add some tests
  
  Revision  ChangesPath
  1.125 +4 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- Changes   12 Feb 2003 23:42:23 -  1.124
  +++ Changes   17 Feb 2003 09:03:16 -  1.125
  @@ -10,6 +10,10 @@
   
   =item 1.99_09-dev
   
  +implement Apache::current_callback + $r-current_callback goes into
  +Apache::compat, since now we have a way too many callbacks unrelated
  +to $r [Stas]
  +
   Add Apache::compat methods: $r-connection-auth_type and
   $r-connection-user (requires 'PerlOptions +GlobalRequest') + tests
   [Stas]
  
  
  
  1.78  +4 -0  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.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- compat.pm 12 Feb 2003 23:42:23 -  1.77
  +++ compat.pm 17 Feb 2003 09:03:16 -  1.78
  @@ -125,6 +125,10 @@
   die $err if $err;
   }
   
  +sub current_callback {
  +return Apache::current_callback();
  +}
  +
   package Apache::Constants;
   
   use Apache::Const ();
  
  
  
  1.54  +2 -0  modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- modperl_callback.c29 Jan 2003 01:04:33 -  1.53
  +++ modperl_callback.c17 Feb 2003 09:03:16 -  1.54
  @@ -172,6 +172,8 @@
   break;
   };
   
  +modperl_callback_current_callback_set(desc);
  +
   /* XXX: deal with {push,set}_handler of the phase we're currently in */
   /* for now avoid the segfault by not letting av-nelts grow if
* somebody push_handlers to the phase we are currently in, but
  
  
  
  1.22  +9 -0  modperl-2.0/src/modules/perl/modperl_callback.h
  
  Index: modperl_callback.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- modperl_callback.h21 Feb 2002 01:45:34 -  1.21
  +++ modperl_callback.h17 Feb 2003 09:03:16 -  1.22
  @@ -10,6 +10,15 @@
   #define ap_hook_fixup  ap_hook_fixups
   #define ap_hook_logap_hook_log_transaction
   
  +#define modperl_callback_current_callback_sv \
  +get_sv(Apache::__CurrentCallback, TRUE)
  +
  +#define modperl_callback_current_callback_set(desc) \
  +sv_setpv(modperl_callback_current_callback_sv, desc)
  +
  +#define modperl_callback_current_callback_get() \
  +SvPVX(modperl_callback_current_callback_sv)
  +
   int modperl_callback(pTHX_ modperl_handler_t *handler, apr_pool_t *p,
request_rec *r, server_rec *s, AV *args);
   
  
  
  
  1.16  +1 -1  modperl-2.0/src/modules/perl/modperl_handler.c
  
  Index: modperl_handler.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_handler.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- modperl_handler.c 1 Jan 2003 03:45:54 -   1.15
  +++ modperl_handler.c 17 Feb 2003 09:03:16 -  1.16
  @@ -175,7 +175,7 @@
   }
   
   #define set_desc(dtype) \
  -MP_TRACE_a_do(if (desc) *desc = modperl_handler_desc_##dtype(idx))
  +if (desc) *desc = modperl_handler_desc_##dtype(idx)
   
   #define check_modify(dtype) \
   if ((action  MP_HANDLER_ACTION_GET)  rcfg) { \
  
  
  
  1.2   +1 -0  modperl-2.0/t/htdocs/.cvsignore
  
  Index: .cvsignore
  ===
  RCS file: /home/cvs/modperl-2.0/t/htdocs/.cvsignore,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .cvsignore26 Feb 2002 19:09:10 -  1.1
  +++ .cvsignore17 

cvs commit: modperl-2.0/xs/maps modperl_functions.map

2002-09-04 Thread dougm

dougm   2002/09/04 18:48:40

  Modified:xs/maps  modperl_functions.map
  Log:
  Apache::Directive-insert is replaced by Apache::Server-add_config
  
  add $r-add_config method
  
  Revision  ChangesPath
  1.45  +3 -1  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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- modperl_functions.map 24 Aug 2002 16:33:15 -  1.44
  +++ modperl_functions.map 5 Sep 2002 01:48:40 -   1.45
   -19,6 +19,8 
mpxs_Apache__RequestRec_get_handlers
mpxs_Apache__RequestRec_location
mpxs_Apache__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
  + modperl_config_insert_request | | \
  +  r, lines, path=r-filename, override=OR_AUTHCFG | add_config
   
#protocol module helpers
mpxs_Apache__RequestRec_location_merge
   -55,6 +57,7 
mpxs_Apache__Server_push_handlers
mpxs_Apache__Server_set_handlers
mpxs_Apache__Server_get_handlers
  + modperl_config_insert_server | | | add_config
   
   PACKAGE=Apache::Server
SV *:DEFINE_dir_config | | server_rec *:s, char *:key=NULL, SV *:sv_val=Nullsv
   -105,6 +108,5 
modperl_spawn_proc_prog | MPXS_ | ... | spawn_proc_prog
   
   MODULE=Apache::Directive
  - mpxs_Apache__Directive_insert
mpxs_Apache__Directive_as_string
   
  
  
  



cvs commit: modperl-2.0/xs/maps modperl_functions.map

2002-01-08 Thread dougm

dougm   02/01/08 14:48:38

  Modified:xs/Apache/RequestIO Apache__RequestIO.h
   xs/maps  modperl_functions.map
  Log:
  dd UNTIE method to avoid warning from pp_untie:
   untie attempted while %d inner references still exist
  which is legit in our case, since we do not create a new object in
  TIEHANDLE, but rather increment the refcount of and existing one.
  
  Revision  ChangesPath
  1.25  +3 -0  modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
  
  Index: Apache__RequestIO.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Apache__RequestIO.h   6 Jan 2002 20:45:36 -   1.24
  +++ Apache__RequestIO.h   8 Jan 2002 22:48:38 -   1.25
  @@ -6,6 +6,9 @@
   #define mpxs_Apache__RequestRec_BINMODE(r) \
   r ? PL_sv_yes : PL_sv_no /* noop */
   
  +#define mpxs_Apache__RequestRec_UNTIE(r, refcnt) \
  +(r  refcnt) ? PL_sv_yes : PL_sv_no /* noop */
  +
   #define mpxs_output_flush(r, rcfg) \
   /* if ($|) */ \
   if (IoFLUSH(PL_defoutgv)) { \
  
  
  
  1.32  +1 -0  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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- modperl_functions.map 20 Dec 2001 18:12:16 -  1.31
  +++ modperl_functions.map 8 Jan 2002 22:48:38 -   1.32
  @@ -30,6 +30,7 @@
apr_size_t:DEFINE_PRINT  | | ...
apr_size_t:DEFINE_PRINTF | | ...
SV *:DEFINE_BINMODE  | | request_rec *:r
  + SV *:DEFINE_UNTIE| | request_rec *:r, int:refcnt
mpxs_Apache__RequestRec_sendfile | | r, filename=r-filename, offset=0, len=0
mpxs_Apache__RequestRec_read | | r, buffer, bufsiz, offset=0
long:DEFINE_READ | | request_rec *:r, SV *:buffer, int:bufsiz, int:offset=0
  
  
  



cvs commit: modperl-2.0/xs/maps modperl_functions.map

2001-12-17 Thread stas

stas01/12/17 08:22:07

  Modified:xs/maps  modperl_functions.map
  Added:   t/response/TestApache subprocess.pm
   xs/Apache/SubProcess Apache__SubProcess.h SubProcess_pm
  Log:
  - implement Apache::SubProcess::spawn_proc_prog (which allows to run a
program in a spawned process and provides in/out/err pipes to it)
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/response/TestApache/subprocess.pm
  
  Index: subprocess.pm
  ===
  package TestApache::subprocess;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Const -compile = 'OK';
  
  use Apache::Test;
  use Apache::TestUtil;
  use File::Spec::Functions qw(catfile catdir);
  
  use Apache::SubProcess ();
  
  my %scripts = (
   argv   = 'print STDOUT @ARGV;',
   env= 'print STDOUT $ENV{SubProcess}',
   in_out = 'print STDOUT scalar STDIN;',
   in_err = 'print STDERR scalar STDIN;',
  );
  
  sub APACHE_TEST_CONFIGURE {
  my ($class, $self) = @_;
  
  my $vars = $self-{vars};
  
  my $target_dir = catdir $vars-{documentroot}, util;
  
  while (my($file, $code) = each %scripts) {
  $file = catfile $target_dir, $file.pl;
  $self-write_perlscript($file, $code\n);
  }
  }
  
  sub handler {
  my $r = shift;
  
  my $cfg = Apache::Test::config();
  my $vars = $cfg-{vars};
  
  # XXX: these tests randomly fail under 5.6.1
  plan $r, todo = [1..4], tests = 4;
  
  my $target_dir = catfile $vars-{documentroot}, util;
  
  {
  # test: passing argv + scalar context
  my $command = catfile $target_dir, argv.pl;
  my @argv = qw(foo bar);
  my $out = Apache::SubProcess::spawn_proc_prog($r, $command, \@argv);
  ok t_cmp(\@argv,
   [split / /, $out],
   passing ARGV
  );
  }
  
  {
  # test: passing env to subprocess through subprocess_env
  my $command = catfile $target_dir, env.pl;
  my $value = my cool proc;
  $r-subprocess_env-set(SubProcess = $value);
  my $out = Apache::SubProcess::spawn_proc_prog($r, $command);
  ok t_cmp($value,
   $out,
   passing env via subprocess_env
  );
  }
  
  {
  # test: subproc's stdin - stdout + list context
  my $command = catfile $target_dir, in_out.pl;
  my $value = my cool proc\n; # must have \n for IN
  my ($in, $out, $err) = 
  Apache::SubProcess::spawn_proc_prog($r, $command);
  print $in $value;
  ok t_cmp($value,
   $out,
   testing subproc's stdin - stdout + list context
  );
  }
  
  {
  # test: subproc's stdin - stderr + list context
  my $command = catfile $target_dir, in_err.pl;
  my $value = my stderr\n; # must have \n for IN
  my ($in, $out, $err) = 
  Apache::SubProcess::spawn_proc_prog($r, $command);
  print $in $value;
  ok t_cmp($value,
   $err,
   testing subproc's stdin - stderr + list context
  );
  }
  
  # could test send_fd($out), send_fd($err), but currently it's only in
  # compat.pm.
  
  # these are wannabe's
  #ok t_cmp(
  # Apache::SUCCESS,
  # Apache::SubProcess::spawn_proc_sub($r, $sub, \@args),
  # spawn a subprocess and run a subroutine in it
  #);
  
  #ok t_cmp(
  # Apache::SUCCESS,
  # Apache::SubProcess::spawn_thread_prog($r, $command, \@argv),
  # spawn thread and run a program in it
  #);
  
  # ok t_cmp(
  # Apache::SUCCESS,
  # Apache::SubProcess::spawn_thread_sub($r, $sub, \@args),
  # spawn thread and run a subroutine in it
  #);
  
 Apache::OK;
  }
  
  
  1;
  __DATA__
  PerlModule Apache::SubProcess
  
  
  
  1.1  modperl-2.0/xs/Apache/SubProcess/Apache__SubProcess.h
  
  Index: Apache__SubProcess.h
  ===
  #include ../../APR/PerlIO/apr_perlio.h
  
  #ifndef MP_SOURCE_SCAN
  #include apr_optional.h
  #endif
  
  #ifndef MP_SOURCE_SCAN
  static APR_OPTIONAL_FN_TYPE(apr_perlio_apr_file_to_glob) *apr_file_to_glob;
  #endif
  
  /* XXX: probably needs a lot more error checkings */
  
  typedef struct {
  apr_int32_tin_pipe;
  apr_int32_tout_pipe;
  apr_int32_terr_pipe;
  apr_cmdtype_e  cmd_type;
  } exec_info;
  
  
  #define FAILED(command) ((rc = command) != APR_SUCCESS)
  
  static int modperl_spawn_proc_prog(request_rec *r,
 const char *command,
 const char ***argv,
 apr_file_t 

cvs commit: modperl-2.0/xs/maps modperl_functions.map

2001-10-28 Thread stas

stas01/10/28 17:19:16

  Modified:src/modules/perl modperl_config.c
   t/response/TestAPI request_rec.pm
   todo api.txt
   xs/Apache/RequestUtil Apache__RequestUtil.h
   xs/maps  modperl_functions.map
  Log:
  - implement $r-location
  
  Revision  ChangesPath
  1.45  +4 -0  modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- modperl_config.c  2001/10/22 17:20:11 1.44
  +++ modperl_config.c  2001/10/29 01:19:16 1.45
  @@ -4,6 +4,8 @@
   {
   modperl_config_dir_t *dcfg = modperl_config_dir_new(p);
   
  +dcfg-location = dir;
  +
   #ifdef USE_ITHREADS
   /* defaults to per-server scope */
   dcfg-interp_scope = MP_INTERP_SCOPE_UNDEF;
  @@ -60,6 +62,8 @@
   
   mrg-flags = modperl_options_merge(p, base-flags, add-flags);
   
  +merge_item(location);
  +
   merge_table_overlap_item(SetVar);
   
   /* XXX: check if Perl*Handler is disabled */
  
  
  
  1.9   +5 -1  modperl-2.0/t/response/TestAPI/request_rec.pm
  
  Index: request_rec.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- request_rec.pm2001/09/28 20:11:02 1.8
  +++ request_rec.pm2001/10/29 01:19:16 1.9
  @@ -11,7 +11,7 @@
   sub handler {
   my $r = shift;
   
  -plan $r, tests = 48;
  +plan $r, tests = 49;
   
   #Apache-request($r); #PerlOptions +GlobalRequest takes care
   my $gr = Apache-request;
  @@ -181,6 +181,10 @@
   ok $r-uri;
   
   ok $r-filename;
  +
  +ok t_cmp('/' . __PACKAGE__,
  + $r-location,
  + location);
   
   my $mtime = (stat __FILE__)[9];
   $r-mtime($mtime);
  
  
  
  1.12  +0 -3  modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- api.txt   2001/10/09 00:14:10 1.11
  +++ api.txt   2001/10/29 01:19:16 1.12
  @@ -85,9 +85,6 @@
   Apache-httpd_conf:
   depends on Perl sections
   
  -$r-location:
  -not yet implemented
  -
   Apache-request:
   need to deal with subclass objects which are not a request_rec
   (e.g. HASH ref)
  
  
  
  1.8   +17 -0 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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Apache__RequestUtil.h 2001/09/28 20:11:02 1.7
  +++ Apache__RequestUtil.h 2001/10/29 01:19:16 1.8
  @@ -179,3 +179,20 @@
   
   #define mpxs_Apache__RequestRec_dir_config(r, key, sv_val) \
   modperl_dir_config(aTHX_ r, r-server, key, sv_val)
  +
  +static MP_INLINE
  +SV *mpxs_Apache__RequestRec_location(request_rec *r)
  +{
  +dTHX; /* XXX */
  +
  +if (r-per_dir_config) {
  +MP_dDCFG;
  +char *location;
  +
  +if ((location = dcfg-location)) {
  +return newSVpv(location, 0); 
  +}
  +}
  +
  +return PL_sv_undef;
  +}
  
  
  
  1.25  +1 -0  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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- modperl_functions.map 2001/10/09 18:01:21 1.24
  +++ modperl_functions.map 2001/10/29 01:19:16 1.25
  @@ -12,6 +12,7 @@
mpxs_Apache__RequestRec_push_handlers
mpxs_Apache__RequestRec_set_handlers
mpxs_Apache__RequestRec_get_handlers
  + mpxs_Apache__RequestRec_location
   
#protocol module helpers
mpxs_Apache__RequestRec_location_merge
  
  
  



cvs commit: modperl-2.0/xs/maps modperl_functions.map

2001-09-28 Thread stas

stas01/09/28 13:11:02

  Modified:src/modules/perl modperl_util.h modperl_util.c
   t/response/TestAPI request_rec.pm server_rec.pm
   xs/Apache/RequestUtil Apache__RequestUtil.h
   xs/maps  modperl_functions.map
  Log:
  - implements modperl_table_get_set for other functions to use
  - implements Apache::Server::dir_config + tests
  - implements Apache::RequestRec::dir_config + tests
  - implements new features coming from modperl_table_get_set for free
$(s|r)-dir_config($key = $val);   # == set($key, $val)
$(s|r)r-dir_config($key = undef); # == unset($key)
  - adds tests for PerlSetVar and PerlAddVar via dir_config
  
  Revision  ChangesPath
  1.19  +6 -0  modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- modperl_util.h2001/09/28 19:24:44 1.18
  +++ modperl_util.h2001/09/28 20:11:01 1.19
  @@ -66,4 +66,10 @@
   MP_INLINE void *modperl_hash_tied_object(pTHX_ const char *classname,
SV *tsv);
   
  +MP_INLINE SV *modperl_dir_config(pTHX_ request_rec *r, server_rec *s,
  + char *key, SV *sv_val);
  +
  +SV *modperl_table_get_set(pTHX_ apr_table_t *table, char *key,
  +  SV *sv_val, bool do_taint);
  +
   #endif /* MODPERL_UTIL_H */
  
  
  
  1.19  +57 -0 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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- modperl_util.c2001/09/25 19:44:02 1.18
  +++ modperl_util.c2001/09/28 20:11:01 1.19
  @@ -386,3 +386,60 @@
   
   return NULL;
   }
  +
  +MP_INLINE
  +SV *modperl_dir_config(pTHX_ request_rec *r, server_rec *s,
  +   char *key, SV *sv_val)
  +{
  +SV *RETVAL = PL_sv_undef;
  +
  +if (r  r-per_dir_config) {   
  +MP_dDCFG;
  +RETVAL = modperl_table_get_set(aTHX_ dcfg-SetVar, key, sv_val, FALSE);
  +}
  +
  +if (!SvTRUE(RETVAL)) {
  +if (s  s-module_config) {
  +MP_dSCFG(s);
  +SvREFCNT_dec(RETVAL); /* in case above did newSV(0) */
  +RETVAL = modperl_table_get_set(aTHX_ scfg-SetVar, key, sv_val, FALSE);
  +} else {
  +RETVAL = PL_sv_undef;
  +}
  +}
  +
  +return RETVAL;
  +}
  +
  +SV *modperl_table_get_set(pTHX_ apr_table_t *table, char *key,
  +  SV *sv_val, bool do_taint)
  +{
  +SV *RETVAL = PL_sv_undef;
  +
  +if (table == NULL) { 
  +/* do nothing */
  +}
  +else if (key == NULL) { 
  +RETVAL = modperl_hash_tie(aTHX_ APR::Table, Nullsv, (void*)table); 
  +}
  +else if (sv_val == PL_sv_no) { /* no val was passed */
  +char *val; 
  +if ((val = (char *)apr_table_get(table, key))) { 
  +RETVAL = newSVpv(val, 0); 
  +} 
  +else { 
  +RETVAL = newSV(0); 
  +} 
  +if (do_taint) { 
  +SvTAINTED_on(RETVAL); 
  +} 
  +}
  +else if (sv_val == PL_sv_undef) { /* val was passed in as undef */
  +apr_table_unset(table, key); 
  +}
  +else { 
  +apr_table_set(table, key, SvPV_nolen(sv_val));
  +} 
  +
  +return RETVAL;
  +}
  
  
  
  1.8   +99 -2 modperl-2.0/t/response/TestAPI/request_rec.pm
  
  Index: request_rec.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- request_rec.pm2001/09/15 19:34:12 1.7
  +++ request_rec.pm2001/09/28 20:11:02 1.8
  @@ -4,11 +4,14 @@
   use warnings FATAL = 'all';
   
   use Apache::Test;
  +use Apache::TestUtil;
   
  +use Apache::Const -compile = 'OK';
  +
   sub handler {
   my $r = shift;
   
  -plan $r, tests = 40;
  +plan $r, tests = 48;
   
   #Apache-request($r); #PerlOptions +GlobalRequest takes care
   my $gr = Apache-request;
  @@ -86,6 +89,80 @@
   
   #user
   
  +#- dir_config tests -#
  +
  +# this test doesn't test all $r-dir_config-*(), since
  +# dir_config() returns a generic APR::Table which is tested in
  +# apr/table.t.
  +
  +# object test
  +my $dir_config = $r-dir_config;
  +ok defined $dir_config  ref($dir_config) eq 'APR::Table';
  +
  +# PerlAddVar ITERATE2 test
  +{
  +my $key = make_key('1');
  +my @received = $dir_config-get($key);
  + 

cvs commit: modperl-2.0/xs/maps modperl_functions.map

2001-04-19 Thread dougm

dougm   01/04/19 18:57:26

  Modified:src/modules/perl modperl_util.c modperl_util.h
   t/filter/TestFilter api.pm
   xs/Apache/Filter Apache__Filter.h
   xs/maps  modperl_functions.map
  Log:
  add Apache::Filter::{TIEHANDLE,PRINT} methods
  
  Revision  ChangesPath
  1.7   +19 -0 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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- modperl_util.c2001/04/09 23:57:22 1.6
  +++ modperl_util.c2001/04/20 01:57:25 1.7
  @@ -33,6 +33,25 @@
   return r;
   }
   
  +MP_INLINE SV *modperl_newSVsv_obj(pTHX_ SV *stashsv, SV *obj)
  +{
  +SV *newobj;
  +
  +if (!obj) {
  +obj = stashsv;
  +stashsv = Nullsv;
  +}
  +
  +newobj = newSVsv(obj);
  +
  +if (stashsv) {
  +HV *stash = gv_stashsv(stashsv, TRUE);
  +return sv_bless(newobj, stash);
  +}
  +
  +return newobj;
  +}
  +
   MP_INLINE SV *modperl_ptr2obj(pTHX_ char *classname, void *ptr)
   {
   SV *sv = newSV(0);
  
  
  
  1.8   +2 -0  modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- modperl_util.h2001/04/09 23:57:22 1.7
  +++ modperl_util.h2001/04/20 01:57:25 1.8
  @@ -16,6 +16,8 @@
   
   MP_INLINE request_rec *modperl_sv2request_rec(pTHX_ SV *sv);
   
  +MP_INLINE SV *modperl_newSVsv_obj(pTHX_ SV *stashsv, SV *obj);
  +
   MP_INLINE SV *modperl_ptr2obj(pTHX_ char *classname, void *ptr);
   
   #define modperl_bless_request_rec(r) \
  
  
  
  1.3   +0 -9  modperl-2.0/t/filter/TestFilter/api.pm
  
  Index: api.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/api.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- api.pm2001/04/20 00:38:09 1.2
  +++ api.pm2001/04/20 01:57:26 1.3
  @@ -13,15 +13,6 @@
   sub init_test_pm {
   my $filter = shift;
   
  -{
  -package Apache::Filter;
  -#XXX: make part of standard api?
  -unless (defined PRINT) {
  -*PRINT = \print;
  -*TIEHANDLE = sub { shift };
  -}
  -}
  -
   tie *STDOUT, $filter;
   
   $Test::TESTOUT = \*STDOUT;
  
  
  
  1.7   +5 -0  modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Apache__Filter.h  2001/04/20 00:38:10 1.6
  +++ Apache__Filter.h  2001/04/20 01:57:26 1.7
  @@ -6,6 +6,11 @@
   || (Perl_croak(aTHX_ "argument is not a blessed reference"),0) ? \
   modperl_filter_mg_get(aTHX_ sv) : NULL)
   
  +#define mpxs_Apache__Filter_TIEHANDLE(stashsv, sv) \
  +modperl_newSVsv_obj(aTHX_ stashsv, sv)
  +
  +#define mpxs_Apache__Filter_PRINT mpxs_Apache__Filter_print
  +
   static MP_INLINE apr_size_t mpxs_Apache__Filter_print(pTHX_ I32 items,
 SV **MARK, SV **SP)
   {
  
  
  
  1.5   +3 -0  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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- modperl_functions.map 2001/04/20 00:38:11 1.4
  +++ modperl_functions.map 2001/04/20 01:57:26 1.5
  @@ -24,3 +24,6 @@
   
mpxs_Apache__Filter_print | | ...
mpxs_Apache__Filter_read  | | ...
  +
  + SV *:DEFINE_TIEHANDLE | | SV *:stashsv, SV *:sv=Nullsv
  + int:DEFINE_PRINT | | ...
  
  
  



cvs commit: modperl-2.0/xs/maps modperl_functions.map

2001-04-19 Thread dougm

dougm   01/04/19 20:07:55

  Modified:Apache-Test/lib/Apache Test.pm
   lib/Apache compat.pm
   lib/ModPerl FunctionMap.pm WrapXS.pm
   xs/Apache/RequestIO Apache__RequestIO.h
   xs/maps  modperl_functions.map
  Log:
  better implementation of Apache::RequestRec::TIEHANDLE
  add Apache::RequestRec::PRINT alias
  expand DEFINE_* prefixes in ModPerl::FunctionTable to avoid name clashes
  
  Revision  ChangesPath
  1.4   +2 -6  modperl-2.0/Apache-Test/lib/Apache/Test.pm
  
  Index: Test.pm
  ===
  RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/Test.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Test.pm   2001/04/18 04:36:56 1.3
  +++ Test.pm   2001/04/20 03:07:52 1.4
  @@ -20,12 +20,8 @@
   sub init_test_pm {
   my $r = shift;
   
  -if (defined Apache::RequestRec::puts) {
  -package Apache::RequestRec;
  -unless (defined PRINT) {
  -*PRINT = \puts;
  -}
  -tie *STDOUT, __PACKAGE__, $r;
  +if (defined Apache::RequestRec::TIEHANDLE) {
  +tie *STDOUT, $r;
   }
   else {
   $r-send_http_header; #1.xx
  
  
  
  1.2   +0 -4  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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- compat.pm 2001/04/12 03:56:49 1.1
  +++ compat.pm 2001/04/20 03:07:53 1.2
  @@ -64,10 +64,6 @@
   untie *STDOUT;
   tie *STDOUT, 'Apache::RequestRec', $r;
   
  -unless (defined PRINT) {
  -*PRINT = \puts;
  -}
  -
   $Request;
   }
   
  
  
  
  1.6   +14 -8 modperl-2.0/lib/ModPerl/FunctionMap.pm
  
  Index: FunctionMap.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/FunctionMap.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionMap.pm2001/04/04 17:12:07 1.5
  +++ FunctionMap.pm2001/04/20 03:07:53 1.6
  @@ -122,14 +122,6 @@
   next;
   }
   
  -my $entry = $map-{$name} = {
  -   name= $alias || $name,
  -   dispatch= $dispatch,
  -   argspec = $argspec ? [split /\s*,\s*/, $argspec] : "",
  -   return_type = $return_type,
  -   alias   = $alias,
  -};
  -
   if (my $package = $cur{PACKAGE}) {
   unless ($package eq 'guess') {
   $cur{CLASS} = $package;
  @@ -141,6 +133,20 @@
   else {
   $cur{CLASS} = $cur{MODULE};
   }
  +
  +#XXX: make_prefix() stuff should be here, not ModPerl::WrapXS
  +if ($name =~ /^DEFINE_/ and $cur{CLASS}) {
  +$name =~ s{^(DEFINE_)(.*)}
  +  {$1 . ModPerl::WrapXS::make_prefix($2, $cur{CLASS})}e;
  +}
  +
  +my $entry = $map-{$name} = {
  +   name= $alias || $name,
  +   dispatch= $dispatch,
  +   argspec = $argspec ? [split /\s*,\s*/, $argspec] : "",
  +   return_type = $return_type,
  +   alias   = $alias,
  +};
   
   for (keys %cur) {
   $entry-{lc $_} = $cur{$_};
  
  
  
  1.7   +1 -0  modperl-2.0/lib/ModPerl/WrapXS.pm
  
  Index: WrapXS.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WrapXS.pm 2001/04/19 17:24:43 1.6
  +++ WrapXS.pm 2001/04/20 03:07:53 1.7
  @@ -348,6 +348,7 @@
   sub make_prefix {
   my($name, $class) = @_;
   my $class_prefix = class_mpxs_prefix($class);
  +return $name if $name =~ /^$class_prefix/;
   $class_prefix . $name;
   }
   
  
  
  
  1.5   +5 -7  modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
  
  Index: Apache__RequestIO.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Apache__RequestIO.h   2001/03/27 04:40:36 1.4
  +++ Apache__RequestIO.h   2001/04/20 03:07:54 1.5
  @@ -1,3 +1,8 @@
  +#define mpxs_Apache__RequestRec_TIEHANDLE(stashsv, sv) \
  +modperl_newSVsv_obj(aTHX_ stashsv, sv)
  +
  +#define mpxs_Apache__RequestRec_PRINT mpxs_ap_rvputs
  +
   #if 0
   #define MP_USE_AP_RWRITE
   #endif
  @@ -66,11 +71,4 @@
   }
   
   return nrd;
  -}
  -
  -static MP_INLINE
  -request_rec *mpxs_Apache__RequestRec_TIEHANDLE(SV *classname,
  -   request_rec *r)
  -{
  -return r;
   }
  
  
  
  

cvs commit: modperl-2.0/xs/maps modperl_functions.map apache_functions.map

2001-03-17 Thread dougm

dougm   01/03/17 09:33:03

  Modified:xs/maps  apache_functions.map
  Added:   xs/maps  modperl_functions.map
  Log:
  move modperl specific functions into their own .map file
  
  Revision  ChangesPath
  1.6   +0 -18 modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apache_functions.map  2001/03/17 06:03:38 1.5
  +++ apache_functions.map  2001/03/17 17:33:03 1.6
  @@ -44,15 +44,6 @@
   !ap_content_type_tolower
ap_get_status_line
ap_is_initial_req
  - mpxs_Apache__RequestRec_push_handlers
  - mpxs_Apache__RequestRec_set_handlers
  - mpxs_Apache__RequestRec_get_handlers
  -
  - #protocol module helpers
  - mpxs_Apache__RequestRec_location_merge
  - mpxs_Apache__RequestRec_set_basic_credentials
  -PACKAGE=Apache::RequestRec
  - mpxs_Apache__RequestRec_new
   
   #MODULE=Apache::RequestConfig
ap_document_root
  @@ -89,8 +80,6 @@
ap_rvputs | mpxs_ | ... | puts
   -ap_vrprintf
   
  - mpxs_Apache__RequestRec_TIEHANDLE
  -
   MODULE=Apache::Response   PACKAGE=guess
ap_make_etag
ap_set_content_length
  @@ -137,9 +126,6 @@
ap_construct_server
ap_construct_url | | r,uri,p
ap_error_log2stderr
  - mpxs_Apache__Server_push_handlers
  - mpxs_Apache__Server_set_handlers
  - mpxs_Apache__Server_get_handlers
   
   #MODULE=Apache::ServerConfig
ap_exists_config_define
  @@ -188,10 +174,6 @@
   MODULE=Apache::Filter PACKAGE=Apache::RequestRec
   ap_filter_t *:DEFINE_add_output_filter | | \
 request_rec *:r, const char *:name, void *:ctx
  -
  -PACKAGE=Apache::OutputFilter
  - mpxs_Apache__OutputFilter_print | | ...
  - mpxs_Apache__OutputFilter_read  | | ...
   
   PACKAGE=guess
   ~ap_add_output_filter
  
  
  
  1.1  modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===
  #modperl specfic functions
  
  MODULE=Apache::RequestUtil   PACKAGE=guess
   mpxs_Apache__RequestRec_push_handlers
   mpxs_Apache__RequestRec_set_handlers
   mpxs_Apache__RequestRec_get_handlers
  
   #protocol module helpers
   mpxs_Apache__RequestRec_location_merge
   mpxs_Apache__RequestRec_set_basic_credentials
  PACKAGE=Apache::RequestRec
   mpxs_Apache__RequestRec_new
  
  MODULE=Apache::RequestIO   PACKAGE=Apache::RequestRec
   mpxs_Apache__RequestRec_TIEHANDLE
  
  MODULE=Apache::ServerUtil   PACKAGE=guess
   mpxs_Apache__Server_push_handlers
   mpxs_Apache__Server_set_handlers
   mpxs_Apache__Server_get_handlers
  
  MODULE=Apache::Filter   PACKAGE=Apache::OutputFilter
   mpxs_Apache__OutputFilter_print | | ...
   mpxs_Apache__OutputFilter_read  | | ...