Software Garden wikiCalc® Program:
wikiCalc and mod_perl version 2
This page provides information about using wikiCalc with version 2 of mod_perl.

wikiCalc flying bird logo
INFORMATION ABOUT WIKICALC AND MOD_PERL VERSION 2

The following information was written in an email by user Don Fike in response to a question about how he figured out how to make wikiCalc version 0.97 work with version 2 of mod_perl. It is provided here with his permission in the hope that others will find it helpful. It assumes knowledge of Perl and Apache.

The current release of wikiCalc provides a script that can be run under mod_perl named wikicalcmodperl.pl. This script was designed to run under mod_perl version 1. A couple of modifications are needed to get the script to run under the newer mod_perl2. In the script add a pointer to the WKC perl modules just before they are called. e.g.

use lib qw( /path/to/wikicalc );
use WKC;
use WKCStrings;
And about line #64 replace the mod_perl version 1 call to Apache with the mod_perl2 call to Apache2. e.g.
# my $areq = Apache->request;
my $areq = Apache2::RequestUtil->request;

The Apache server needs to know to run this script under mod_perl. You can do this with a <Files> block or a <Directory> or <Location> block similar to the ones below;

PerlModule ModPerl::Registry
<Files *.apl>
 SetHandler perl-script
 PerlResponseHandler ModPerl::Registry
 Options +ExecCGI
</Files>

When using a <Files> block rename the wikicalcmodperl.pl file so that the extension matches the one declared, .apl in this case.

You could do something similar with <Directory>, e.g.

PerlModule ModPerl::Registry
<Directory /path/to/wikicalc>
 SetHandler perl-script
 PerlResponseHandler ModPerl::Registry
 Options +ExecCGI
</Directory>

See this site for additional information: http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html

Also if you enforce taint checking in your environment using something like; PerlSwitches -T in your httpd.conf or perl.conf you might run into insecure dependencies. You can turn off taint checking or try to sanitize the data with a back reference similar to the ones below.

WKCDataFiles.pm line 1233

if ($filename =~ /^([-\/\w.]+)$/) {
 $filename = $1;                     # $data now untainted
} else {
 die "Bad data in filename: '$filename'";      # log this somewhere
}

WKCDataFiles.pm line 263

if ($whichsite =~ /^([-\/\w.]+)$/) {
 $whichsite = $1;                     # $data now untainted
} else {
 die "Bad data in whichsite: '$whichsite'";      # log this somewhere
}


(c) Copyright 2007 Software Garden, Inc.
All Rights Reserved.

wikiCalc, Software Garden, and Garden are registered trademarks of Software Garden, Inc.
Dan Bricklin's is a registered trademark of Daniel S. Bricklin.