Greg,

You will probably need to read some documentation:

http://perl.apache.org/docs/index.html
http://perl.apache.org/docs/1.0/guide/porting.html

Note that last one is mod_perl-based, not mod_perl2, but it is a reasonable introduction. Also, the mod_perl book is available online:

http://modperlbook.org/

and is a fantastic resource.

There are, of course, many websites devoted to getting started with mod_perl.

----- Original Message ----- From: "Greg Donald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 18, 2004 4:35 PM
Subject: mod_perl questions



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?

In the documentation are some simple tests you can cut-and-paste to see if mod_perl is up and running.


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:

Perl scripts that run under CGI will need to be "handled" by ModPerl::Registry. There are some specific details about writing scripts under ModPerl::Registry, mainly relating to the fact that the script is kept "alive" so that Global variables do not automatically go out of scope between requests. See this link for details.


http://perl.apache.org/docs/1.0/guide/porting.html

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

I am relatively new to mod_perl myself and I continue to be amazed by what I have available via mod_perl. And the performance gain really cannot be overestimated for heavy-traffic sites, it seems.


As for putting perl into your HTML, you may find templating is what you are interested in. There a number of options (see http://perl.apache.org/docs/tutorials/tmpl/comparison/comparison.html), most of which do not require mod_perl. I wouldn't put that high on my list of reasons to change from cgi to mod_perl. In fact, there are many good reasons NOT to put perl (or really much of any logic) into your HTML.

Sean



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