Problems with Perl sections.

2000-07-01 Thread Michael J Schout

I'm having some issues with Perl sections.  Basically what I have is a setup
like this:

httpd.conf:

Perl
   my %handlers = (
   '/foo' = { HANDLER = 'GKG::Foo', FILTER = 1 },
   '/bar/foo' = { HANDLER = 'GKG::FooBar' }
   );

   for my $i (keys %handlers) {
   my %conf = %{$handlers{$i}};
   $Location{$i} = {
   PerlHandler = $conf{HANDLER},
   SetHandler  = 'perl-script'
   };

   if (defined $conf{FILTER}) {
   push @{ $Location{$i}-{PerlSetVar} }, ['Filter', 'On'];
   }
   }
/Perl


The problem is that when this gets configured it does not seem to correctly
deal with the URL locations.  In my case, both /foo and /bar/foo  execute
GKG::Foo.  It seems to think that since location "/bar/foo" contains "/foo"
that it should use the handler "GKG::Foo" instead of handler "GKG::FooBar".

Also, standard static urls such as "/js/foo.js" end up getting caught by mod
perl and the output from "GET /js/foo.js" will be the content from the
perl-handler GKG::Foo, not the contents of the static file /js/foo.js!  

If I configure it without perl-sections like this:

Location /foo
SetHandler perl-script
Perlhandler GKG::Foo
/Location
  
Location /bar/foo
SetHandler perl-script
Perlhandler GKG::FooBar
/Location

Then it works correctly.  So there definately seems to either be a problem with
Perl sections, or the semantics of using %Location inside a Perl section does
not agree with the standard Location block.

Does anyone have any ideas what might be the problem here?  Is this a bug, or
am I just using this incorrectly?

Thanks for any ideas :).

I'm using mod_perl 1.24, perl 5.6.0 Linux 2.2.x

Mike




Re: Problems with Perl sections.

2000-07-01 Thread Michael J Schout

Ok I think I might have figured this one out.

If I treat the keys of %Location as regexps I sseem to get the desired results
:).

e.g.: '^/foo$', '^/bar/foo$'

Maybe this shold be documented in the guide better?

Mike
 




Two problems with Perl sections...

2000-05-03 Thread Robert S. Thau

Hi.  I'm having two problems with Perl sections --- one resulting in
a server coredump, and the other just odd.  My test configuration is
Apache/1.3.12 and mod_perl_1.23 built from distributed sources with:

  perl Makefile.PL DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 PERL_TRACE=1 
APACHE_PREFIX=/opt/software/mpsandbox APACHE_HEADER_INSTALL=0

conf/httpd.conf is identical to httpd.conf_default except for a
different Port, and the following at the end:

  Perl
  do 'conf/conf.pl';
  /Perl

If conf/conf.pl contains:

  @Listen=(5050,5051);
  #$ServerAdmin='[EMAIL PROTECTED]';
  1;

then everything works as expected.  My problems are:

1) If the ServerAdmin line is uncommented, then the server dumps
   core on startup.  Backtrace included below.

2) If I comment the ServerAdmin line back out, but change the 'do'
   in httpd.conf to a 'require', the server starts, but is not listening
   on ports 5050 and 5051 when it does.  What makes this case peculiar
   is that with MOD_PERL_TRACE=ds, the output produced by the PERL_TRACE
   facility is the same in both cases; it claims to find and execute the
   Limit commands either way.

   This may have something to do with the 'require' not reading the file
   a second time... but if @INC is preserved, I would have expected the
   vars in the Apache::ReadConfig symbol table to be preserved as well.

Any ideas what's up?

BTW, on another topic, what's up with support for Perl sections in
Apache/2.0?  Some of the discussion on new-httpd seems to indicate that
it's not quite there yet...

rst

PS:  Here's the backtrace from the coredump:

#0  0x40151fea in _IO_vfprintf (s=0xbfff8e98, 
format=0x811e1c9 "perl_section: /%s\n", ap=0xbfffb60c) at vfprintf.c:1248
#1  0x40154ed8 in buffered_vfprintf (s=0x401f4260, 
format=0x811e1c9 "perl_section: /%s\n", args=0xbfffb608)
at vfprintf.c:1747
#2  0x40150856 in _IO_vfprintf (s=0x401f4260, 
format=0x811e1c9 "perl_section: /%s\n", ap=0xbfffb608) at vfprintf.c:1018
#3  0x401586f7 in fprintf (stream=0x401f4260, 
format=0x811e1c9 "perl_section: /%s\n") at fprintf.c:32
#4  0x807f4ec in perl_filesection ()
#5  0x807f7db in perl_handle_command_hv ()
#6  0x8080149 in perl_section ()
#7  0x80956e9 in ap_clear_module_list ()
#8  0x8096163 in ap_handle_command ()
#9  0x80961f7 in ap_srm_command_loop ()
#10 0x8096600 in ap_process_resource_config ()
#11 0x8096ec2 in ap_read_config ()
#12 0x80a0ed9 in main ()
#13 0x40123cb3 in __libc_start_main (main=0x80a0c4c main, argc=1, 
argv=0xb894, init=0x8060068 _init, fini=0x8116ffc _fini, 
rtld_fini=0x4000a350 _dl_fini, stack_end=0xb88c)
at ../sysdeps/generic/libc-start.c:78