You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Robert J Bartels <rb...@pop.uky.edu> on 2000/02/21 20:54:52 UTC

perl newbie

Hi all,

   I'm trying to set up apache with mod-perl. I would like someone to clarify
a few things for me. I originally thought that when I compiled in mod_perl 
support
for apache that it had turned on a perl 5 interpreter. The docs said that I 
could then
run perl directly from a html document. Sounds great! Now I read about 
embperl...
Embperl says you can user perl in your html code... Isn't that what I did 
when I compiled
mod_perl into apache?!??!? Am I missing something here?
For instance, I compiled PHP into another apache server and it works 
great.. I just put my PHP code inside <? ?> and it
interprets it... If I user embperl do I still need to encapsulate it ? Or 
just copy my perl scripts and rename the file
from .pl to .html???
Also what if I want to be able to use PHP and Perl embedded scripting.. is 
this possible?


Thanks.. Hope its not too convoluted.

Bob


Robert Bartels
Network Administrator
Department of Physiology
MS571 Chandler Medical Center
University of Kentucky 40536
606.323.6264
physiology.uky.edu


RE: perl newbie

Posted by Gerald Richter <ri...@ecos.de>.
>
> Compiling mod_perl into Apache embeds a Perl 5 interpretter into
> the Apache
> server process. This doesn't necessarily mean Perl code can be embedded in
> HTML documents, but it means you can extend the capabilities of the Apache
> server using Perl. EmbPerl is just one example of how Apache can be
> extended using mod_perl. Without mod_perl, EmbPerl would not be possible.
>

mod_perl allows you to execute normal Perl scripts (with access to the
Apache API and much faster then CGI), Embperl allows you to embedd Perl code
into HTML documents, like PHP does this for it's own language.

Gerald

BTW. Embperl can run without mod_perl (as CGI or offline), but it's correct
that the fastest way to run Embperl is under mod_perl and then Embperl is
build on top of mod_perl.


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


Re: perl newbie

Posted by "Doran L. Barton" <fo...@iodynamics.com>.
Not long ago, Robert J Bartels proclaimed...
>    I'm trying to set up apache with mod-perl. I would like someone to clarify
> a few things for me. I originally thought that when I compiled in mod_perl 
> support
> for apache that it had turned on a perl 5 interpreter. The docs said that I 
> could then
> run perl directly from a html document. Sounds great! Now I read about 
> embperl...
> Embperl says you can user perl in your html code... Isn't that what I did 
> when I compiled
> mod_perl into apache?!??!? Am I missing something here?

Compiling mod_perl into Apache embeds a Perl 5 interpretter into the Apache
server process. This doesn't necessarily mean Perl code can be embedded in
HTML documents, but it means you can extend the capabilities of the Apache
server using Perl. EmbPerl is just one example of how Apache can be
extended using mod_perl. Without mod_perl, EmbPerl would not be possible. 

How's that for an answer?

-- 
Doran L. Barton <fo...@iodynamics.com>
Iodynamics LLC -- "Internetworking the masses"
<URL:http://www.iodynamics.com/>

Re: perl newbie

Posted by "G.W. Haywood" <ge...@jubileegroup.co.uk>.
Hi there,

On Mon, 21 Feb 2000, Robert J Bartels wrote:

> I'm trying to set up apache with mod-perl. I would like someone to
> clarify a few things for me.  I originally thought that when I
> compiled in mod_perl support for apache that it had turned on a perl
> 5 interpreter. The docs said that I could then run perl directly
> from a html document.

There are two main ways to run Perl scripts from Apache.

1.  Apache on its own.  When a document written in HTML refers to
    a Perl script, Apache starts the Perl interpreter which just 
    happens to be kicking around on your system and tells it what 
    script to run.  The script runs, the Perl interpreter exits.
    End of story.  We sometimes call it plain vanilla Apache but
    that's not official.

2.  Apache/mod_perl.  This version of Apache has a Perl interpreter
    all of its own inside it.  Consequently it's much bigger and much 
    faster and generally much more trouble to configure and keep under 
    control.  When an HTML document refers to a Perl script, Apache
    doesn't have to start the interpreter, it's already there.  But
    the same basic mechanism for calling the script can be used, give
    or take a module or two.

There are two main ways to run Perl scripts from HTML.

1.  Refer in the document to the file which contains the script.
    You use the file name (it's probably something.pl), and it's
    possibly in a directory called cgi-bin but let's not get too
    far ahead of ourselves.  Either of the Apaches above will do.

2.  Embed Perl (or PHP, Python, Tcl or whatever) right into the HTML
    files.  There's no separate Perl script file.  Neither version of
    Apache above will do, you have more work to do or the browser will
    probably choke on what isn't really HTML any more.  EmbPerl is one
    way of doing that work - er, well, actually, Gerald Richter did it
    for you.  Say thank you, Gerald.

> Sounds great!

Yup.

> Embperl says you can use perl in your html code...

Yup, that's right.

> Isn't that what I did when I compiled mod_perl into apache?!??!?

No.

> Am I missing something here?

Hopefully we've now sorted that out, but let me know if not.

73,
Ged.