[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
<FilesMatch "*.(css|js||gif|jpe?g|png)">
     SetHandler default-handler

That should work.

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


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

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


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:


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

<Location />
    SetHandler perl-script
    PerlHandler MyModule

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
directive. So "/index.html" should have a PerlHandler applied to it, but 
"/images/portrait.jpg" should be processed by the PerlHeaderParserHandler
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



Perl mailing list
Perl at perl.org.il

More information about the Perl mailing list