Playing with mod_perl

I thought I'd have a go with mod_perl. I do loads of Perl, but hadn't tried this yet. Of course, it didn't work at first (these things never do). It turns out that the one thing which isn't mentioned anywhere in the documentation (at least I couldn't find it anywhere I'd expect it) is that you need this in httpd.conf:

LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so

So far I've only tried a simple test program, but the nice thing is that straight away I can play with keeping stuff in memory persistent between connections. This updates a count every time the page is created:

#!/usr/bin/perl -w
use strict;

print "Content-Type: text/plain\n\n";

our $foo;

if ($ENV{MOD_PERL}) {
   print "Count: ", ++$foo;
}
else {
   print "This isn't mod_perl.";
}

< C++ functional programming yuckiness | C++ in Stevenage >

Miniblog

(nuggets of inanity)

Tuesday Apr 24th 2007, 16:54 »
Just took the annual web design survey that AListApart do. I don't realy consider myself to be a web designer, but I have been doing a lot of HTML and CSS lately.
Monday Apr 23rd 2007, 18:23 »
Strange, there appears to be a bare-knuckle boxing match going on in the field outside my flat. Wish they wouldn't make so much noise about it.
Thursday Mar 1st 2007, 18:47 »
“In its written form, Hebrew has no vowels, making it the ideal language for texting.”
—Said in jest on some Radio 4 programme just now.

Archive: 2007 · 2006 · 2005 · 2004
Feed