Mailing List Archive

mod_perl -> application server
Hi, after the recent discussion here about Perl application servers I
realized that the architecture I designed is probably better suited to
usage with an application server than mod_perl.

The basic structure of my mod_perl web application is:

*.pl files are handled by ModPerl::Registry

All *.pl files are structured in the following way:

#!/usr/bin/perl

use strict;
use CGI;
...

&main;

sub main {
...
}



I use CGI.pm 99% ONLY for dealing with input, $cgi->param() ... 99% of
output is either JSON or Template Toolkit generated HTML.

Should I be looking at CGI::Application?

Or CGI::PSGI?

Or even CGI::Emulate::PSGI ?

Should I ask this elsewhere?

Thanks for any advice!

Tosh


--
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
Re: mod_perl -> application server [ In reply to ]
Hello Tosh. I stopped using CGI.pm a very long time ago after
learning about the apreq2 library which provides access to the
Apache2::Request module. Particularly, there is support for CGI
parameters, including multiple file uploads from the same HTML form,
and also the Cookie API:

http://search.cpan.org/~isaac/libapreq2-2.13/glue/perl/lib/Apache2/Request.pm

In addition to mod_perl2, you'll also need to install libapreq2. On
NetBSD (the server Operating System that I use), the packages and
pkgin systems both support this very well with Apache HTTPd v2.2 and
Apache HTTPd v2.4 on all of my production systems. As I understand
it, these modules are also supported very well on other flavours of
Unix and probably most (if not all) distributions of Linux.

Apache2::Request is not a drop-in replacement for CGI.pm (or at
least it wasn't when I initially switched to Apache2::Request), but
it does provide the functionality needed to handle HTTP's GET and
POST methods used with HTML forms in a feature-rich manner with a lot
of flexibility for handling file uploads.

(I don't know if mod_perl2 provides support for accessing CGI
parameters without apreq, and I have not looked into it.)

After I first made the change from CGI.pm to using apreq2, I noticed
that CPU utilization was dramatically lower during peak times for my
busier web sites, so I felt that this was well worth the effort.

> Hi, after the recent discussion here about Perl application servers I
> realized that the architecture I designed is probably better suited to
> usage with an application server than mod_perl.
>
> The basic structure of my mod_perl web application is:
>
> *.pl files are handled by ModPerl::Registry
>
> All *.pl files are structured in the following way:
>
> #!/usr/bin/perl
>
> use strict;
> use CGI;
> ...
>
> &main;
>
> sub main {
> ...
> }
>
>
>
> I use CGI.pm 99% ONLY for dealing with input, $cgi->param() ... 99% of
> output is either JSON or Template Toolkit generated HTML.
>
> Should I be looking at CGI::Application?
>
> Or CGI::PSGI?
>
> Or even CGI::Emulate::PSGI ?
>
> Should I ask this elsewhere?
>
> Thanks for any advice!
>
> Tosh
>
>
> --
> McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/


Randolf Richardson - randolf@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/
Re: mod_perl -> application server [ In reply to ]
You can use mod_perl properly and write your self a request handler -
rather than using CGI scripts which handles the routing for you. I use
this model exclusively on my servers...

Most of the scripts are converted to action modules, which are
dynamically compiled by the handler (which acts as a router/controller)

It uses apreq2 (APR) rather than CGI

I think CGI::Application is (or at least was deprecated)


On 2017-04-06 11:05 AM, Tosh Cooey wrote:
> Hi, after the recent discussion here about Perl application servers I
> realized that the architecture I designed is probably better suited to
> usage with an application server than mod_perl.
>



--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.