perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: file globbing question
Date Wed, 20 Feb 2002 13:02:36 GMT
Cees Hek wrote:
> 
> On Wed, 2002-02-20 at 13:27, John Stauffacher wrote:
> > All,
> >
> > I am a bit confused as to what httpd.conf directives need to be used in
> > order to get apache to execute a PerlHandler when it encounters a
> > certain file type. What I want to do:
> >       Execute a handler whenever a *.qw file is accessed. The same
> > handler whether or not the file exists and not look for the file. So the
> > user makes the request: get /somewhere/my.qw and gets the response
> > "moo". Then they request /other/place/boo.qw and gets the response
> > "moo". I have tried using a <Files> directive, but it envokes the
> > handler, then looks for the file and throws a 404. Any ideas?
> 
> The <Files> directive is the right way to go.  Are you sure you are
> returning OK in your Handler?  If you return something else (like
> DECLINED) then Apache will take over the request and handle it in the
> default manner (ie look up the file).  Returning OK lets Apache know
> that the request was dealt with appropriately and it can move on to the
> next phase.
> 

another alternative is something like Apache::MIMEMapper...

http://www.modperlcookbook.org/download/Apache-MIMEMapper-0.10.tar.gz

which expands the AddHandler directive to make it a bit more mod_perl
friendly.

so, instead of using <Files> (which is perfectly legitimate) you can
instead simply use

AddHandler My::Module .qw

and Apache will use My::Module::handler() for the content-generation
phase.

all the stuff Cees said it true, though - you still need to make sure
your handler returns OK and follow the other handler rules. 

HTH

--Geoff

Mime
View raw message