[Israel.pm] a couple of mod_perl questions

semuel semuel at semuel.co.il
Thu Jul 8 10:20:17 PDT 2004


Hello There.


1. All the idea of preloading a module is to save memory. So if MyModule is
being loaded in the startup, and is loading CGI, it's good.

2. What you are looking for is PerlTransHandler. But it should not be inside
a Directory or Location directive, but outside them.

So, your configuration should be:
PerlTransHandler MyTransHandler
<Location "/">
   SetHandler perl-script
   PerlHandler MyModule
</Location>
<FilesMatch "*.(css|js||gif|jpe?g|png)">
     SetHandler default-handler
</FilesMatch>

That should work.
Semuel.


-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Scott Weisman
Sent: Thursday, July 08, 2004 8:56 AM
To: perl at perl.org.il
Subject: [Israel.pm] a couple of mod_perl questions

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__Locatio
n_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

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl






More information about the Perl mailing list