NAME
CGI::Wiki::Simple::Plugin - Base class for CGI::Wiki::Simple plugins.
DESCRIPTION
This is the base class for special interactive Wiki nodes where the content is produced programmatically, like the LatestChanges page and the AllNodes page. A plugin subclass implements more or less the same methods as a CGI::Wiki::Store - a later refactoring might convert all Plugin-subclasses to CGI::Wiki::Store subclasses or vice-versa.
SYNOPSIS
package CGI::Wiki::Simple::Plugin::MyPlugin;
use strict;
use Carp qw(croak);
use CGI::Wiki::Simple::Plugin( name => 'MyPlugin' );
sub retrieve_node_data {
my ($wiki) = shift;
my %args = scalar @_ == 1 ? ( name => $_[0] ) : @_;
croak "No valid node name supplied"
unless $args{name};
# $args{name} is the node name
# $args{version} is the node version, if no version is passed, means current
# ... now actually retrieve the content ...
my @results = ("Hello world",0,"");
my %data;
@data{ qw( content version last_modified ) } = @results;
$data{checksum} = md5_hex($data{content});
return wantarray ? %data : $data{content};
};
# Alternatively, if your plugin can handle more than one node :
package CGI::Wiki::Simple::Plugin::MyMultiNodePlugin;
use strict;
use CGI::Wiki::Simple::Plugin (); # No automatic import
sub import {
my ($module,@nodenames) = @_;
CGI::Wiki::Simple::Plugin::register_nodes(module => $module, names => [@nodenames]);
};