I've used Perl off and on for years but I am now trying to work with
mod_perl and I have some questions/issues.


How can I tell if I have mod_perl configured correctly?  I installed
it with `emerge mod_perl` on my Gentoo box.  I am running Apache2.  I
see the line:

Apache/2.0.52 (Gentoo/Linux) mod_perl/1.99_11 Perl/v5.8.5 PHP/5.0.3
Server at destiney.mine.nu Port 80

when I type a nonexistant url.  Is that it as far a "complete" mod_perl install?



My apache config contains this:

<IfModule mod_perl.c>
#Provide two aliases to the same cgi-bin directory,
#to see the effects of the 2 different mod_perl modes
#for Apache::Registry Mode
Alias /perl/ /var/www/localhost/perl/
#for Apache::Perlrun Mode
Alias /cgi-perl/ /var/www/localhost/perl/
</IfModule>

<IfModule mod_perl.c>
    PerlModule Apache2::ModPerl::Registry
    #set Apache::Registry Mode for /perl Alias
    # To set subdirectories to use perl set the following 
    # and comment the orignial:
    # <Location ~ "^/perl/.*\.pl$">

    <Location  "^/perl/*.pl>
        SetHandler perl-script
        <IfDefine MODPERL2>
            PerlResponseHandler Apache2::ModPerl::Registry
        </IfDefine>
        <IfDefine !MODPERL2>
            PerlResponseHandler ModPerl::Registry
        </IfDefine>
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>

    #set Apache::PerlRun Mode for /cgi-perl Alias
    <Location /cgi-perl/*.pl>
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>
</IfModule>

So does that mean when I put a .pl script in /perl/ it will be
executed by mod_perl and not #!/usr/bin/perl?  Seems to not be the
case since when I remove the #!/usr/bin/perl from the top of a script
it breaks it and I get error like:

[Sat Dec 18 14:43:31 2004] [error] [client 10.0.0.3] (8)Exec format
error: exec of '/var/www/localhost/perl/hello.pl' failed
[Sat Dec 18 14:43:31 2004] [error] [client 10.0.0.3] Premature end of
script headers: hello.pl

in my logs.  I read somewhere in the docs when using mod_perl that the
#!/usr/bin/perl is no longer required, so I'm thinking maybe I'm not
done with the apache configuration?


What is the advantage to running mod_perl versus just running perl
scripts out of my cgi-bin ?  I suspect there is a performance gain
from to the interpreter already existing in memory or something, but
is there some new syntax I get to use now?  Can I now include Perl
code directly into my html?


Thanks for any help you send..


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to