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."; }