You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael J Schout <ms...@gkg.net> on 2000/07/01 19:03:45 UTC

Problems with sections.

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 sections.

Posted by Michael J Schout <ms...@gkg.net>.
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