UseModWiki | RecentChanges | Preferences

One of the GlobalVariables.

This variable only has an effect if it is set in the script--it does not do anything useful in the config file. Here is the one use of RunCGI:

&DoWikiRequest()  if ($RunCGI && ($_ ne 'nocgi'));   # Do everything.

Essentially, it is a way to load the wiki without running it. This is useful for PersistentCGI environments like mod_perl. (You can also set $_ to 'nocgi' to get the same effect.) Here is an example script using this load-but-not-running feature:

# Demonstration of shared wiki code.

$_ = 'nocgi';  # Do not run script immediately when loaded
require "/home/usemod/cgi-bin/wiki.pl";
$UseModWiki::LogoLeft = 1;  # Other config changes can be done this way
&UseModWiki::DoWikiRequest();  # Do the request

[This script uses the 'nocgi' method instead of $RunCGI. I could have changed "um9.pl" to set $RunCGI to 0, and eliminated the $_ = 'nocgi' line in this script.]

Setting $_ to 'nocgi' appears to be a fragile method. Are we supposed to trust that $_ will never be changed in a script with >5000 lines of code? Even if that happened to be the case when the above example was written, will it be the case tomorrow, especially if you take into consideration all the patches that people add to their own script copies? --GunnarH
Question: Wouldn't it be a good idea to move the setting of $RunCGI in the script from the "Major options" section to the section with meta-config variables that need to be set in the script, and at the same time remove the option from the config file? Now it's kind of confusing. --GunnarH

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited March 22, 2009 12:41 am by GunnarH (diff)