Re: Perl-CGI Question About ModPerl

  • From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 18 Nov 2008 23:17:25 +0200

Could you be a little more clear? :-)
Sorry but I didn't understand your question.


Octavian

----- Original Message ----- From: <james.homme@xxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, November 18, 2008 7:37 PM
Subject: Re: Perl-CGI Question About ModPerl


Hi Teddy,
If you are just learning Perl, what do you need to think about when it
comes to this?

Thanks.

Jim

James D Homme, Usability Engineering, Highmark Inc.,
james.homme@xxxxxxxxxxxx, 412-544-1810

"The difference between those who get what they wish for and those who
don't is action. Therefore, every action you take is a complete
success,regardless of the results." -- Jerrold Mundis
Highmark internal only: For usability and accessibility:
http://highwire.highmark.com/sites/iwov/hwt093/



            "Octavian
            Rasnita"
            <orasnita@xxxxxxx                                          To
            om>                       programmingblind@xxxxxxxxxxxxx
            Sent by:                                                   cc
            programmingblind-
            bounce@freelists.                                     Subject
            org                       Re: Perl-CGI Question About ModPerl


            11/18/2008 11:27
            AM


            Please respond to
            programmingblind@
              freelists.org






There are more ways of using mod_perl Apache module.

Unlike mod_php or many other Apache modules that handle the "response"
phase, mod_perl can do much more.
It can handle all Apache's request phases, and if I remember well there are

7 phases.

But of course, most users use mod_perl for handling the response phase
only.

When you use mod_perl, you create only perl modules, and those modules
become Apache modules, like other Apache modules written in C.
So when you start the server, the mod_perl modules are loaded a single
time.
You can even delete the mod_perl modules after you start the server, and
your site will work with no problem.

Using mod_perl require using another interface that you must learn, and it
might seem to be a little harder to learn than the CGI interface.

For example, in each of your modules you need to use some mod_perl modules
like Apache2::RequestRec and others that offer some functionality, and you
need to create a subroutine named "handler".

And you will need to take care and re-initialize the variables, because
otherwise if a visitor set a value to a variable, the next visitor might
see
it.

But mod_perl also offers the possibility of using a simple CGI program with

mod_perl in 2 ways. One of them allows to load the file only once like the
mod_perl handlers, however that CGI program must be well written and
initialize the variables everywhere, and the other way loads the CGI script

on each request, so it will work slower, just like the common CGI, but it
will work even if the script is not well written.
The variables will be re-initialized because the scripts will be loaded on
each request.

But anyway, a recommended way for creating web apps with perl is not to use

CGI or mod_perl and start the program from zero.
A much better way is to use a framework like Catalyst or CGI::Application.
It requires much less code for doing something, the necessary code is much
clean, it offers the possibility of using many templating systems easier,
it
offers an ORM that you can choose, it offers a simpler and powerful way to
do authorization, authentication, sending email, and many other things. And

you can use the application you create with the framework with CGI,
fastcgi,
or mod_perl.

But these beeing said, if a web server supports mod_perl, I doubt it
doesn't
support CGI at all.
mod_cgi is another Apache module just like mod_perl.

Octavian

----- Original Message -----
From: <james.homme@xxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, November 18, 2008 5:48 PM
Subject: Perl-CGI Question About ModPerl



Hi,
If someone is learning how to use Perl for CGI, is it transparent to them
if their web host uses ModPerl or do they have to code differently for
ModPerl than they do with CGI?

Thanks.

Jim

James D Homme, Usability Engineering, Highmark Inc.,
james.homme@xxxxxxxxxxxx, 412-544-1810

"The difference between those who get what they wish for and those who
don't is action. Therefore, every action you take is a complete
success,regardless of the results." -- Jerrold Mundis
Highmark internal only: For usability and accessibility:
http://highwire.highmark.com/sites/iwov/hwt093/

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: