LoadModule perl_module modules/mod_perl.so
# ...
#AllowOverride None
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
# the next part is not required for this recipe to work
#AllowOverride None
SetHandler perl-script
PerlHandler ModPerl::PerlRun
Options ExecCGI
allow from all
PerlOptions +ParseHeaders
####
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlSendHeader on
##
##
package TestModPerl;
my $total = 0;
my $counter = 0;
sub run {
$counter = 0;
for (1 .. 5) {
increment_counter();
}
}
sub increment_counter {
$counter++;
print "Counter is equal to $counter!
\n";
}
sub total {
$total++;
print "This has run $total times.
\n";
}
1;
__END__
# apparently in mod_perl2 having __END__ is OK.
##
##
#!/usr/bin/perl
BEGIN { push @INC, "/home/YOURACCOUNTNAMEHERE/public_html"; }
use strict;
use TestModPerl;
print "Content-type: text/html\n\n";
TestModPerl::run();
TestModPerl::total();