Mark James wrote:
Hello All,

Took me a day, but I think I've finally been able to move my
scripts from plain cgi perl to mod_perl2.  The extensive documention
on perl.apache.org was invaluable, though I have some comments below.

One question: Prior to using mod_perl I was able to have
unsuffixed scripts and .html files residing together in the
server root directory by using Apache's "Files" directive to
force the scripts to be executed: e.g.

    <Files db>
            ForceType application/x-httpd-cgi
    </Files>

I can't seem to do this with mod_perl because I now have to use
a SetHandler directive on the directory, so Apache now executes
the HTML files.  I've tried forcing the scripts to type
application/x-httpd-perl, but this doesn't work.

I'd like to keep both the scripts and HTML docs in the root
directory so that URLs are as short as possible, but can I
do this with mod_perl without having to use URL re-writing?

Set the normal behavior per dir/location and then override for specific files


  <Location /perl>
     SetHandler perl-script
     ...
  </Location>
  <Files *.html>
    SetHandler default
  </Files>

if I remember correctly you can even nest that <Files> container inside the <Location> container.

Finally, some comments on mod_perl installation:

1. In http://perl.apache.org/docs/1.0/guide/getwet.html , use of x.x.x
for both the Apache and mod_perl version numbers made me think that
the version numbers had to be matched. Maybe y.y.y should be used
for one.

Please get used to x.x.x meaning any. Otherwise we would need to remember to use z.z.z. for php plugs in and f.f.f. when openssl is added, etc... hope you get the idea.


It also should be stated in this section that one has to
   use mod_perl-2.x if one is running Apache 2.y.

yup, thank you, will fix that shortly.


2. In the configuration section of the 2.0 docs
(http://perl.apache.org/docs/2.0/user/intro/start_fast.html#toc_Configuration)


   it neglects to state the need to issue a directive for the mod_perl
   handler one is going to use, e.g. "PerlModule ModPerl::Registry",
   though it is covered in the configuration docs (including the
   startup-file option).

you mean preloading the module? That's not necessarily in mp2, though advisable for performance reasons.


In mp2, you can say:

PerlResponseHandler ModPerl::Registry

without:

PerlModule ModPerl::Registry

you can also use the syntactic sugar to preload modules, by simply stating at the beginning of your mod_perl configuration 'PerlOptions +Autoload'. See
http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_


or using + before the handler name:

PerlResponseHandler +ModPerl::Registry

Thanks to all mod_perl coders!

Thanks for the comments.



__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com



Reply via email to