NAME

CGI::Wiki::Kwiki - An instant wiki built on CGI::Wiki.

DESCRIPTION

A simple-to-use front-end to CGI::Wiki. It can be used for several purposes: to migrate from a CGI::Kwiki wiki (its original purpose), to provide a quickly set up wiki that can later be extended to use more of CGI::Wiki's capabilities, and so on. It uses the Template Toolkit to allow quick and easy customisation of your wiki's look without you needing to dive into the code.

METHODS

new

Creates a new CGI::Wiki::Kwiki object. Expects some options, most have defaults, a few are required. Here's how you'd call the constructor - all values here (apart from formatters) are defaults; the values you must provide are marked.

    my $wiki = CGI::Wiki::Kwiki->new(
        db_type => 'MySQL',
        db_user => undef,                     # required
        db_pass => '',
        db_name => undef,                     # required
        formatters => {
            documentation => 'CGI::Wiki::Formatter::Pod',
            tests         => 'My::Own::PlainText::Formatter',
            discussion    => [
                               'CGI::Wiki::Formatter::UseMod',
                               allowed_tags   => [ qw( p b i pre ) ],
                               extended_links => 1,
                               implicit_links => 0,
                             ],
            _DEFAULT      => [ # if upgrading from pre-0.4
                               'CGI::Wiki::Formatter::UseMod;
                             ],
                      },                  # example only, not default
        site_name => 'CGI::Wiki::Kwiki site',
        admin_email => 'email@invalid',
        template_path => undef,               # required
        home_node => 'HomePage',
        cgi_path => CGI::url(),
        search_map => './search_map',
    );

The db_type parameter refers to a CGI::Wiki::Store::[type] class. Valid values are 'MySQL', SQLite', etc: see the CGI::Wiki man page and any other CGI::Wiki::Store classes you have on your system. db_user and db_pass will be used to access this database.

formatters should be a reference to a hash listing all the formatters that you wish to support. Different wiki pages can be formatted with different formatters; this allows you to do things like have documentation pages written in POD, test suite pages written in plain text, and discussion pages written in your favourite Wiki syntax. If this hash has more than one entry, its keys will be supplied in a drop-down list on every edit screen, and the selected one will be used when displaying that page.

(If you do wish to supply more than one entry to the hash, you will need CGI::Wiki::Formatter::Multiple installed on your system.)

Each value of the formatters hash can be either a simple scalar giving the class of the required formatter, or an anonymous array whose first entry is the class name and whose other entries will be passed through to the formatter instantiation, parsed as a hash. (See the discussion formatter entry in the example code above if this sounds confusing.)

Note: Even if your formatters hash has only one entry, you should make its key be meaningful, since it will be stored in the node's metadata and will appear in dropdowns if you ever decide to support another kind of formatter.

Backwards Compatibility Note: If you are upgrading from a version of CGI::Wiki::Kwiki earlier than 0.4, and you have an existing wiki running on it, you should supply a _DEFAULT entry in the formatters hash so it knows what to do with nodes that have no formatter metadata stored.

This method tries to create the store, formatter and wiki objects, and will die() if it has a problem. It is the calling script's responsibility to catch any exceptions and tell the user.

run

Runs the wiki object, and outputs to STDOUT the result, including the CGI header. Takes no options.

    $wiki->run();

TODO

Things I still need to do

Polish templates
Import script should catch case-sensitive dupes better

SEE ALSO

AUTHOR

Tom Insam (tom@jerakeen.org)

CREDITS

Thanks to Kake for writing CGI::Wiki, and providing the initial patches to specify store and formatter types in the config. And for complaining at me till I released things.

COPYRIGHT

     Copyright (C) 2003 Tom Insam.  All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.