Perl CGI or Something Else CGI?

R

Rg

Hello everyone,

I am writing drafts for an online system that must be accessible via
Web and must make use of some DBMS (probably MySQL). I am planning on
using Perl CGI, but I can't really make up my mind about that decision.

The one fact that prevents me from starting to write Perl CGI right
away is efficency. It worries me that every page hit should have the
Perl interpreter instantiated and then have it logged into the DBMS.
Instead, I'd like something that would stay memory-resident and already
logged into the DBMS. I thought then of using pure C CGI and linking
page requests with a resident process. But, of course, I can't really
make up my mind about that decision...

So, here's the question: should I actually worry about starting up the
Perl interpreter and then logging into the DBMS at the expense of
efficiency? Does that really happen or Perl CGI works in some other way
that I'm just missing here? And, finally, does it pay to use pure C CGI
or PHP instead of Perl CGI?

Rg
 
M

Mirco Wahab

Rg said:
So, here's the question: should I actually worry about starting up the
Perl interpreter and then logging into the DBMS at the expense of
efficiency? Does that really happen or Perl CGI works in some other way
that I'm just missing here? And, finally, does it pay to use pure C CGI
or PHP instead of Perl CGI?

You could use mod_perl (http://perl.apache.org/), which is
a (almost pure C) persistent perl process. Combine this
with HTML::Mason (http://www.masonbook.com/), so you could
put a


<%ONCE>
my $dbh = $dbh | open_database(.. ... ...);
...

</%ONCE>

at the bottom of each file dealing
with the data model


Regards

Mirco
 
R

Rg

Responses very much appreciated. Thanks!



to 2.32 are not compatible with the mod_perl Apache module. There
are also reported issues with Perl version, CGI.pm and mod_perl
select combinations.

For all failure case examples, CGI.pm is the problem, not Perl
nor the mod_perl module.

Generally speaking, CGI.pm versions 2.32 and up will work with
Perl version 5.6 and up, and any version of the mod_perl module
which is system compatible.

Purl Gurl
 
U

usenet

Rg said:
It worries me that every page hit should have the
Perl interpreter instantiated and then have it logged into the DBMS.

You are not unique - that has worried a lot of people.
Instead, I'd like something that would stay memory-resident and already
logged into the DBMS.

Then what you want is mod_perl. It does EXACTLY what you want,
including keeping the database connection(s) resident (it even
overloads the database disconnect() method with no-op, so even if you
TRY to disconnect you don't really do so).

Nearly any well-written Perl script will run without modification on a
mod_perl-enabled webserver. The criteria for "well-written" is not
very high - if your program compiles OK with the "use strict" pragma
then there's a very, very good possibility it is "well-written" enough
for mod_perl (see the docs for more specifics: http://perl.apache.org)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top