This tutorial is designed to show you how to use those features of C.P.W. which enable you to modify CPW's code.
It assumes that you know about wikis and the UsemodWiki conventions already. A general how-to-use-a-wiki page will be added later.
Please feel free to post questions onto these pages if anything is unclear.
Please note that we are in the middle of a name change (from SPW to CPW). So, some things are still "spw" (specifically, all of the actual program code uses "spw", as does much of the docs). Please pardon the confusion.
CPW is a wiki written in Perl which allows arbitrary community members to make changes to the wiki engine code. CPW runs as the user "spw", and it "owns" the directory /spw
. Accordingly, the community can modify anything under the /spw
directory (but not most other parts of the filing system). See FilesysCommands for a list of commands which view or modify the filesystem.
The basic process for submitting a change to CPW's code is:
All proposed changes to the code must be approved by the community. When you submit a change, there is a 4 day peer review period. During this period, anyone may effectively veto your change -- either because they don't like it, or just because they want more than 4 days to consider it. To "veto" a change, modify the page containing the change in any way -- this restarts the approval period. Note that any change may be re-vetoed indefinitely (even by a single person). If/when a 4-day period elapsed without any new vetos, the proposed patch is applied automatically by the CPW software.
This example should only take a few minutes to work through. (please update this estimate if I'm wrong). This example was checked against a GNU/Linux system. Maybe it works for other systems, too (let us know).
cd /tmp
wget -O spw.tar 'http://purl.net/net/cpw/spw.pl?action=download&path=\/spw\/spw.tar'
tar -xovf spw.tar
/tmp/spw/qsetup.pl
.htaccess
file in /tmp
or somewhere else with the line SetHandler cgi-scipt
to turn off mod_perl.
cd /tmp/spw/bin
cp /tmp/spw/bin/spw_main.pl /tmp/spw/bin/spw_main.pl.old
} elsif ($action eq "stupid") {
&ReportError(Ts("I'm stupid"));
diffs
isn't a typo):
../diffs spw_main.pl.old spw_main.pl > my_patch
#DoPatch
<nowiki><pre></pre></nowiki>
my_patch
in the example) and paste it into the wiki page, in between <pre> tags. You should have something a lot like#DoPatch <pre> *** /spw/bin/spw_main.pl.old Mon May 12 23:50:15 2003 --- /spw/bin/spw_main.pl Tue May 13 00:33:11 2003 *************** *** 2450,2453 **** --- 2450,2455 ---- } elsif ($action eq "showls") { &DoShowLs(); + } elsif ($action eq "stupid") { + &ReportError(Ts("I'm stupid")); } else { # Later improve error reporting
</pre>
patching file /spw/bin/spw_main.pl
*** /spw/bin/spw_main.pl.old Mon May 12 23:50:15 2003 --- /spw/bin/spw_main.pl Tue May 13 00:33:11 2003 *************** *** 2450,2453 **** --- 2450,2455 ---- } elsif ($action eq "showls") { &DoShowLs(); + } elsif ($action eq "stupid") { + &ReportError(Ts("I'm stupid")); } else { # Later improve error reporting
Please be sure and read over other people's proposed changes to make sure they are good (and not hazardous to security). Be liberal in vetoing changes that you would like more time to read or think about.
That's all you need to get started. For example, with this method you should be able to take a patch from UseMod:WikiPatches? and apply it to spw_main.pl!
If you are interested in learning more about how CPW works, you might be interested in the other pages in CategoryOverview.