[Israel.pm] a couple of mod_perl questions

Scott Weisman sweisman at pobox.com
Wed Jul 7 23:55:45 PDT 2004


Hello,

I've got some questions about mod_perl I was hoping someone could help me 
with.

I am reading about startup.pl and pre-loading modules here:

http://perl.apache.org/docs/1.0/guide/config.html#toc_The_Confusion_with_use___in_the_Server_Startup_File

I am confused. Do I need to pre-load a module if I use() another module in 
startup.pl that itself use()s that module? Let's say I have a module 
MyModule.pm, that has a line "use CGI qw(-compile :all);" and I do a "use 
MyModule;" in starup.pl; do I then need to add a line "use CGI ();" to 
startup.pl as well? If so, why? Wouldn't pre-loading MyModule.pm also 
pre-load CGI?

I am confused on the order of processing the Directory, Location, and Files 
directives. I am referring to:

http://perl.apache.org/docs/1.0/guide/config.html#toc_How_Directory__Location_and_Files_Sections_are_Merged

I've got a section of http.conf that looks like this:

<LocationMatch ".+\.(css|js||gif|jpe?g|png)$">
    sethandler perl-script
    PerlHeaderParserHandler MyModules->uri_xlat_handler
</LocationMatch>

<Location />
    SetHandler perl-script
    PerlHandler MyModule
</Location>

What I want is that for static content like images, css, and js files, I can 
modify the URI or the filename before it gets resolved. Is the 
PerHeaderParserHandler the correct handler, or perhaps the PerlTransHandler 
or the PerlPostReadRequestHandler?

I also don't want a PerlHandler for any request that matches the LocationMatch 
directive. So "/index.html" should have a PerlHandler applied to it, but 
"/images/portrait.jpg" should be processed by the PerlHeaderParserHandler (or 
whatever is the correct handler) ONLY. How would I do this? Is the above 
correct? Or should I do something like this:

<Location />
    SetHandler perl-script
    PerlHandler MyModule

    <LocationMatch ".+\.(css|js||gif|jpe?g|png)$">
        SetHandler perl-script
        PerlHeaderParserHandler MyModules->uri_xlat_handler
    </LocationMatch>
</Location>

Thanks,

Scott




More information about the Perl mailing list