The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OpenPlugin::Plugin - Base class for all plugins

SYNOPSIS

 use OpenPlugin::Plugin;

 @MyPlugin::Config::ISA = qw( OpenPlugin::Plugin );

 # or

 use base qw( OpenPlugin::Plugin );

DESCRIPTION

This class is a base class for all plugins, and provides a series of methods which can all be overloaded by the individual plugins or drivers.

METHODS

init()

This method is called whenever a plugin is loaded for the first time, and can be used to initiate settings, objects, and any other resources that a plugin may need.

load()

Returns the class name for a given plugin (OpenPlugin::PluginName).

new()

Constructor for plugins. Returns an object for a given plugin.

type()

This method must be implemented within each plugin. It returns the name of the plugin.

OP()

This method must be implemented within each plugin. It simply returns the 'root' OpenPlugin object.

For example, within the Log plugin, $self is-a OpenPlugin::Plugin object, but not a OpenPlugin. To access methods of the main OpenPlugin class or other plugins, from within the Log plugin, you would use:

 $self->OP->method_name();

 or to access another plugin from within any given plugin:

 $self->OP->plugin_name->plugin_method();

state()

This method is used to save and retrieve state information in a namespace just for the plugin using this function.

cleanup()

This method is used to tell the plugin that the application is exiting, and to clean up any information it may have sitting around. At the very least, this consists of it's state information.

shutdown()

This method is used to tell the plugin to shutdown. This would include things like closing database connections and such.

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

OpenPlugin

Class::Factory

COPYRIGHT

Copyright (c) 2001-2003 Eric Andreychek. All rights reserved.

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

AUTHORS

Eric Andreychek <eric@openthought.net>