CGI::Wiki::Plugin - A base class for CGI::Wiki plugins.


CGI-Wiki documentation Contained in the CGI-Wiki distribution.

Index


Code Index:

NAME

Top

CGI::Wiki::Plugin - A base class for CGI::Wiki plugins.

DESCRIPTION

Top

Provides methods for accessing the backend store, search and formatter objects of the CGI::Wiki object that a plugin instance is registered with.

SYNOPSIS

Top

  package CGI::Wiki::Plugin::Foo;
  use base qw( CGI::Wiki::Plugin);

  # And then in your script:
  my $wiki = CGI::Wiki->new( ... );
  my $plugin = CGI::Wiki::Plugin::Foo->new;
  $wiki->register_plugin( plugin => $plugin );
  my $node = $plugin->datastore->retrieve_node( "Home" );

METHODS

Top

new
  sub new {
      my $class = shift;
      my $self = bless {}, $class;
      $self->_init if $self->can("_init");
      return $self;
  }

Generic contructor, just returns a blessed object.

datastore

Returns the backend store object, or undef if the register_plugin method hasn't been called on a CGI::Wiki object yet.

indexer

Returns the backend search object, or undef if the register_plugin method hasn't been called on a CGI::Wiki object yet, or if the wiki object had no search object defined.

formatter

Returns the backend formatter object, or undef if the register_plugin method hasn't been called on a CGI::Wiki object yet.

SEE ALSO

Top

CGI::Wiki

AUTHOR

Top

Kake Pugh (kake@earth.li).

COPYRIGHT

Top


CGI-Wiki documentation Contained in the CGI-Wiki distribution.
package CGI::Wiki::Plugin;

use strict;

use vars qw( $VERSION );
$VERSION = '0.03';

sub new {
    my $class = shift;
    my $self = bless {}, $class;
    $self->_init if $self->can("_init");
    return $self;
}

sub datastore {
    my $self = shift;
    $self->{_datastore} = $_[0] if $_[0];
    return $self->{_datastore};
}

sub indexer {
    my $self = shift;
    $self->{_indexer} = $_[0] if $_[0];
    return $self->{_indexer};
}

sub formatter {
    my $self = shift;
    $self->{_formatter} = $_[0] if $_[0];
    return $self->{_formatter};
}

1;