Re: How do you use mod_perl for your web application?

2011-06-17 Thread Vincent Veyron
Le jeudi 16 juin 2011 à 14:11 -0700, Joe Schaefer a écrit :

 
 To me writing to a generic webserver API is not all that exciting.
 Python people love it, but they've never had a proper exposure
 to httpd in the first place.  Yes it means you gain some portability,
 but the downside is that you lose an awful lot of power that comes
 from the existing open source module ecosystem for httpd.  That's not
 easily replaced, no matter what others may say.
 

Power indeed. 

I wrote an application for case management that uses mod_perl's and
postgresql's specific features, via simple mod_perl handlers (LAMP to me
means Linux/Apache/Mod_Perl/Postgres).

The result is 15 milliseconds response times to generate an html page
with authentication and a hit to the database, on commodity hardware. My
application serves five to six users all day with a 1.6 Ghz processor
(200 dollar machine, 0 license) which peaks at 0.3% usage on busy
weekdays. That leaves me room for growth.

I don't suppose you can get the same numbers using frameworks?

-- 
Vincent Veyron
http://marica.fr/
Logiciel de gestion des sinistres et des contentieux pour le service juridique



Re: How do you use mod_perl for your web application?

2011-06-17 Thread Dave Morgan

On 15/06/11 10:01 PM, Fred Moyer wrote:

I'm interested in hearing about what application frameworks (Catalyst,
CGI::App, Mojolicious) are used here with mod_perl.


We currently support an open source corporate CMS called Metapoint
http://www.metapointcms.com (derived from Metadot, derived from
the original Redhat CMS) which runs on mod_perl 1.3 and mod_perl 2.0.x
without change

It is fully dynamic. supporting MySQL, Postgres, SQLLite and Oracle.
It easily integrates with external systems including VOIP and and
source control applications. It is easily extendible so that any
code can be called through wrappers in perl modules.

We do nothing fancy with mod-perl, everything is done with
Apache::Registry. We use a fair number of Apache modules, including
mod_deflate as Fred mentioned earlier.

In order to leverage other programmers work we have  spent a lot
of time looking at web frameworks and have a prototype running
under Catalyst. We will gradually port our code ( and clean up
a lot of crap) to Catalyst and I hope to be running on it
within a year.

Years ago we compiled apache, mod_perl and our other modules from
source but now we rely on the CentOS packages.

I really have no interest in perl webservers per se but I would like
to hear about other frameworks that may meet our needs.
Mojolicious appears to be a little underdeveloped for what we want
but I am willing to be corrected on this.

HTH
Dave

--
Dave Morgan
Operations Manager, BorealEscapes
http://www.borealescapes.ca
dave.mor...@borealescapes.ca
403 288 8759


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Fred Moyer f...@redhotpenguin.com on Thu, 06/16/11 at 13:56:

 Hmm, odd that it wouldn't work under 2.0.5 but it would under 2.0.4.

I have spent some time today looking at the change logs for both
mod_perl2 and apache2 to see what, if anything, might point to a
change that could have produced my current problem.  I found none.

I originally thought based on this error output from apachectl -t:

   [Mon Jun 13 10:16:15 2011] [error] syntax error at (eval 21) line 1, near 
require Apache2::Const -\n
   [Mon Jun 13 10:16:15 2011] [error] Can't load Perl module Apache2::Const 
-compile = ':common' for server localhost:80, exiting...

that the problem stemmed from the first of these two lines:

   PerlModule Apache2::Const -compile = ':common'
   PerlModule APR::Const -compile = ':common'

which are found inside a *.conf file in the Includes directory of apache2.

BTW, these two lines are the only two lines in the entire source tree
of the application in question that contain the string :common.  But
since I am merely trying to launch the apache server, the Perl application
has not come into play yet, except for the parsing of the httpd.conf
file and the above mentioned include file found in the Includes directory.

When I comment out the first line, I get a similar error, but this time
it mentions the second line:

   [Fri Jun 17 12:17:41 2011] [error] syntax error at (eval 21) line 1, near 
require APR::Const -\n
   [Fri Jun 17 12:17:41 2011] [error] Can't load Perl module APR::Const 
-compile = ':common' for server localhost:80, exiting...

When I comment out the second line, I get this output on the console:

freebsd# apachectl -t
Use of uninitialized value in lc at 
/usr/local/lib/perl5/site_perl/5.14.0/Class/DBI.pm line 196.
Syntax OK
Attempt to free unreferenced scalar: SV 0x28bda050 during global destruction.
Attempt to free unreferenced scalar: SV 0x28be05b4 during global destruction.
Attempt to free unreferenced scalar: SV 0x28be080c during global destruction.
Attempt to free unreferenced scalar: SV 0x28d1c21c during global destruction.
Attempt to free unreferenced scalar: SV 0x28d19e60 during global destruction.
Attempt to free unreferenced scalar: SV 0x28be076c during global destruction.
Attempt to free unreferenced scalar: SV 0x28be04ec during global destruction.
Attempt to free unreferenced scalar: SV 0x28d1c208 during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda7a8 during global destruction.
Attempt to free unreferenced scalar: SV 0x28be0708 during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda618 during global destruction.

BTW: ignore the DBI error since that occurred when starting apache prior
to my system upgrade last week.

So the syntax is now okay, but something else breaks and the server fails
to start.  It seems like there is something wrong with the handling of the
PerlModule directive.  For example, is require parsing different from
use parsing?

I don't see how anything I have done, or the application that worked before
the upgrade, could be at fault here.  Something in apache2 or mod_perl2 or
their APIs has changed, perhaps related to the newish Perl 5.14 version.

I don't know how to approach this other than by asking the mailing lists
for some guidance.  Thanks for your help.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread Fred Moyer
On Fri, Jun 17, 2011 at 10:29 AM, William Bulley w...@umich.edu wrote:
 I have Perl 5.14 compiled from source.
 I have apache 2.2.19  compiled from source.
 I have mod_perl2 2.0.5 compiled from source (with these patches):

Can you pull 2.0.6-dev from svn and build?

http://perl.apache.org/download/source.html

  % svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/
mod_perl-2.0


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread Perrin Harkins
On Fri, Jun 17, 2011 at 12:34 PM, William Bulley w...@umich.edu wrote:
   PerlModule Apache2::Const -compile = ':common'
   PerlModule APR::Const -compile = ':common'

That syntax used to work?  It seems unlikely.  I've never seen a
PerlModule call with options like this before.  I'd expect it to work
without the -compile = ':common' stuff.

This sort of thing usually goes in a startup.pl, not inside
httpd.conf.  It's easier to manage there and things don't get pulled
into surprising namespaces.

- Perrin


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Fred Moyer f...@redhotpenguin.com on Fri, 06/17/11 at 13:43:

 On Fri, Jun 17, 2011 at 10:29 AM, William Bulley w...@umich.edu wrote:
  I have Perl 5.14 compiled from source.
  I have apache 2.2.19 ?compiled from source.
  I have mod_perl2 2.0.5 compiled from source (with these patches):
 
 Can you pull 2.0.6-dev from svn and build?
 
 http://perl.apache.org/download/source.html
 
   % svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/
 mod_perl-2.0

I will certainly attempt to do so.  Stay tuned...  ;-)

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to James B. Muir james.b.m...@hitchcock.org on Fri, 06/17/11 at 
13:29:
 
 Have you checked the permissions on the Const.pm module?

freebsd% ls -l /usr/local/lib/perl5/site_perl/5.14.0/mach/APR/Const.pm \
/usr/local/lib/perl5/site_perl/5.14.0/mach/Apache2/Const.pm \
/usr/local/lib/perl5/site_perl/5.14.0/mach/ModPerl/Const.pm
-r--r--r--  1 root  wheel  23410 Jun 10 17:08 
/usr/local/lib/perl5/site_perl/5.14.0/mach/APR/Const.pm
-r--r--r--  1 root  wheel  25924 Jun 10 17:08 
/usr/local/lib/perl5/site_perl/5.14.0/mach/Apache2/Const.pm
-r--r--r--  1 root  wheel   3080 Jun 10 17:08 
/usr/local/lib/perl5/site_perl/5.14.0/mach/ModPerl/Const.pm


Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Perrin Harkins per...@elem.com on Fri, 06/17/11 at 13:44:

 On Fri, Jun 17, 2011 at 12:34 PM, William Bulley w...@umich.edu wrote:
  ? PerlModule Apache2::Const -compile = ':common'
  ? PerlModule APR::Const -compile = ':common'
 
 That syntax used to work?  It seems unlikely.  I've never seen a
 PerlModule call with options like this before.  I'd expect it to work
 without the -compile = ':common' stuff.
 
 This sort of thing usually goes in a startup.pl, not inside
 httpd.conf.  It's easier to manage there and things don't get pulled
 into surprising namespaces.

Yes.  Yes.  Yes!  :-)

This is what is so consternating for me to grok.

Others have suggested that I strip the parameters - I did and no change.

Others suggested I place the module(s) invocation inside (the existing)
Perl.../Perl tags - I did and no change.  Go figure?

Those two Const -compile lines were not in the httpd.conf file.

They were in an included *.conf file in the Includes directory
which might be the same thing, but I'm a pedantic sort of guy...  :-)

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread Perrin Harkins
On Fri, Jun 17, 2011 at 2:18 PM, William Bulley w...@umich.edu wrote:
 Others have suggested that I strip the parameters - I did and no change.

 Others suggested I place the module(s) invocation inside (the existing)
 Perl.../Perl tags - I did and no change.  Go figure?

Have you tried making a startup.pl and calling these from there with use() ?

 They were in an included *.conf file in the Includes directory
 which might be the same thing, but I'm a pedantic sort of guy...  :-)

In terms of how mod_perl treats them, that shouldn't make a difference here.

- Perrin


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Perrin Harkins per...@elem.com on Fri, 06/17/11 at 14:24:
 
 Have you tried making a startup.pl and calling these from there with use() ?

Recall that all I'm trying to do at this point is to get the apache
server up and running.  The fact that these two lines in this include
file of this particular application case apachectl -t to error out
should have nothing to do with the application and how it does or does
not start up.

Are you saying that a suitably constructed startup.pl file with these
two lines included would be useful to debugging this problem?  If so,
then what all does one need in a standard startup.pl, for example, that
I could use as a model?  Thanks.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread Perrin Harkins
On Fri, Jun 17, 2011 at 3:20 PM, William Bulley w...@umich.edu wrote:
 Recall that all I'm trying to do at this point is to get the apache
 server up and running.  The fact that these two lines in this include
 file of this particular application case apachectl -t to error out
 should have nothing to do with the application and how it does or does
 not start up.

Well, presumably they compile constants that your code needs.  But I
see that you tried commenting them out, which is a good idea, and then
got some unreferenced scalar errors, which were not related to these
lines.

I'd probably try stripping down your conf file to try to find what
causes these errors, taking out chunks of mod_perl-related stuff until
it starts without complaint.

- Perrin


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Fred Moyer f...@redhotpenguin.com on Fri, 06/17/11 at 13:43:

 On Fri, Jun 17, 2011 at 10:29 AM, William Bulley w...@umich.edu wrote:
  I have Perl 5.14 compiled from source.
  I have apache 2.2.19 ?compiled from source.
  I have mod_perl2 2.0.5 compiled from source (with these patches):

 Can you pull 2.0.6-dev from svn and build?

 http://perl.apache.org/download/source.html

   % svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/
 mod_perl-2.0

I have just built/installed mod_perl-2.0.6 (not sure about the dev part)
and tried again to start the apache server (using # apachectl -t):

   [Fri Jun 17 16:05:58 2011] [error] syntax error at (eval 21) line 1, near 
require Apache2::Const -\n
   [Fri Jun 17 16:05:58 2011] [error] Can't load Perl module Apache2::Const 
-compile = ':common' for server localhost:80, exiting...

This is very frustrating...  :-(

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread Fred Moyer
I think Perrin is right, I've never seen -compile syntax used in
PerlModule directives.  Move the PerlModule directives into a
startup.pl file.

In your httpd.conf:

LoadModule perl_modulemodules/mod_perl.so
PerlPostConfigRequire /my/startup.pl

In your startup.pl:

#!/usr/bin/perl

use strict;
use warnings;

# make sure we are in a sane environment.
$ENV{MOD_PERL} or die GATEWAY_INTERFACE not Perl!;

use Apache2::Const -compile = ':common';

... add any other PerlModule statements in the 'use Module' format.

On Fri, Jun 17, 2011 at 1:09 PM, William Bulley w...@umich.edu wrote:
 According to Fred Moyer f...@redhotpenguin.com on Fri, 06/17/11 at 13:43:

 On Fri, Jun 17, 2011 at 10:29 AM, William Bulley w...@umich.edu wrote:
  I have Perl 5.14 compiled from source.
  I have apache 2.2.19 ?compiled from source.
  I have mod_perl2 2.0.5 compiled from source (with these patches):

 Can you pull 2.0.6-dev from svn and build?

 http://perl.apache.org/download/source.html

   % svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/
 mod_perl-2.0

 I have just built/installed mod_perl-2.0.6 (not sure about the dev part)
 and tried again to start the apache server (using # apachectl -t):

   [Fri Jun 17 16:05:58 2011] [error] syntax error at (eval 21) line 1, near 
 require Apache2::Const -\n
   [Fri Jun 17 16:05:58 2011] [error] Can't load Perl module Apache2::Const 
 -compile = ':common' for server localhost:80, exiting...

 This is very frustrating...  :-(

 Regards,

 web...

 --
 William Bulley                     Email: w...@umich.edu

 72 characters width template -|



Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Fred Moyer f...@redhotpenguin.com on Fri, 06/17/11 at 16:22:

 I think Perrin is right, I've never seen -compile syntax used in
 PerlModule directives.  Move the PerlModule directives into a
 startup.pl file.
 
 In your httpd.conf:
 
 LoadModule perl_modulemodules/mod_perl.so
 PerlPostConfigRequire /my/startup.pl
 
 In your startup.pl:
 
 #!/usr/bin/perl
 
 use strict;
 use warnings;
 
 # make sure we are in a sane environment.
 $ENV{MOD_PERL} or die GATEWAY_INTERFACE not Perl!;
 
 use Apache2::Const -compile = ':common';
 
 ... add any other PerlModule statements in the 'use Module' format.

Fine.  But what has this got to do with the inability of the apache
server to start?  These PerlModule directives are not my idea.  They
came with the application in question (to which I am trying to get).

Once I get the apache server running, I can deal with issues like
this one.  BTW, the application in question does not have a startup
file, it just has an index.html file and uses Mason, but that is
neither here nor there as far as this problem is concerned.

Recall that with these two Const -compile lines commented out
of that include file, the syntax phase of apachectl -t succeeds,
but the server does not start, and a bunch of other errors appear.

This, to me, sounds like an issue between apache2 and Perl 5.14 or
between mod_perl2 and Perl 5.14, but I don't really have any clue.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How do you use mod_perl for your web application?

2011-06-17 Thread Randolf Richardson
 I'm interested in hearing about what application frameworks (Catalyst,
 CGI::App, Mojolicious) are used here with mod_perl.  Given the number
 of emerging Perl based webservers on CPAN (in addition to Nginx,
 lighty, etc), it seems like there are many more Perl web application
 and webservers out there now than there were five years ago.
[sNip]

I'm using mod_perl2 for custom internet site development.  Where 
many people might use static HTML pages, or other programming 
languages such as JSP (and others), I have a .pl (Perl source code) 
file in its place (e.g., index.pl instead of index.html).

On one of my web sites, I documented the steps that I use to 
configure mod_perl2 for this (working sample source code included):

How to install and configure ModPerl 2
http://www.modperl.pl/how-to/

I am hosting hundreds of web sites that I developed with mod_perl2, 
and although most of them are small (and static pages could have 
worked just fine too), there are a few that have PostgreSQL database 
backends (membership management, PayPal integration, full transaction 
history browsing, private forums, etc.).

I did use DBIx::Class for a while, but eventually moved back to 
straight DBI (and I just finished converting the last site a few days 
ago).  I think DBIx::Class is a wonderful system, but the problem I 
had with it is that new versions were behaving unexpectedly in ways 
that would cause my web sites to stop functioning (unless I enabled 
various backward compabitility options), and then re-generating 
classes eventually resulted in the custom classes having to be 
updated as well.  So, I moved back to DBI which is doing the job very 
well for me, and which I find is also more flexible despite being a 
little bit less convenient.  I suspect that I wouldn't be running 
into these issues with a framework system designed to work with 
DBIx::Class.  A DBIx developer in IRC explained to me once that 
DBIx::Class also goes to great lengths to shut off connection caching 
from the Apache::DBI module -- after switching back to DBI, the 
resulting performance gain has me wondering if this is correct.

At one point I started to create a telnet server for a BBS-type 
system (just for fun), but had to put it on the back-burner due to 
time-constraints (customizing one of Apache 2 HTTPd's connection 
handlers made this possible).  Originally I started out using 
mod_perl on Novell's NetWare OS, but Novell stopped pre-compiling 
mod_perl2 so I switched to NetBSD (which I've been using ever since).

I also started writing a Wiki system from scratch, and plan to 
continue with that eventually.

I don't use proxying or virtualization for my web servers (it's all 
running bare-metal), just raw mod_perl2.  I'm extremely pleased with 
the high performance and solid reliability that I get from mod_perl2 
on NetBSD servers, and intend to keep using it (and promoting it) for 
years to come.

Randolf Richardson - rand...@inter-corporate.com
Inter-Corporate Computer  Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.inter-corporate.com




Re: apache2 or mod_perl2 oddball error

2011-06-17 Thread William Bulley
According to Perrin Harkins per...@elem.com on Fri, 06/17/11 at 15:35:

 On Fri, Jun 17, 2011 at 3:20 PM, William Bulley w...@umich.edu wrote:
  Recall that all I'm trying to do at this point is to get the apache
  server up and running. ?The fact that these two lines in this include
  file of this particular application case apachectl -t to error out
  should have nothing to do with the application and how it does or does
  not start up.
 
 Well, presumably they compile constants that your code needs.  But I
 see that you tried commenting them out, which is a good idea, and then
 got some unreferenced scalar errors, which were not related to these
 lines.
 
 I'd probably try stripping down your conf file to try to find what
 causes these errors, taking out chunks of mod_perl-related stuff until
 it starts without complaint.

Excellent suggestion!  Thanks!   :-)

This is where I will pick up the reins when I next return to this
effort.  I'll report back here what I find out.  Thanks again.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|