NAME

Zoidberg::Fish - Base class for loadable Zoidberg plugins

SYNOPSIS

package My_Zoid_Plugin;
use base 'Zoidberg::Fish';

FIXME some example code

DESCRIPTION

Once this base class is used your module smells like fish -- Zoidberg WILL eat it. It supplies stub methods for hooks and has some routines to simplefy the interface to Zoidberg. One should realize that the bases of a plugin is not the module but the config file. Any module can be used as plugin as long as it's properly configged. The developer manual should describe this in more detail.

METHODS

new($parent, $zoid_name)

Simple constructor that bootstraps same attributes. When your module smells like fish Zoidberg will give it's constructor two arguments, a reference to itself and the name by which your module is identified. From this all other config can be deducted.

	# Default attributes created by this constructor:
 
	$self->{parent}    # a reference to parent Zoidberg object
	$self->{zoid_name} # name by which your module is identified
	$self->{settings}  # reference to hash with global settings
	$self->{config}    # hash with plugin specific config
init()

To be overloaded, will be called directly after the constructor. Do things you normally do in the constructor like loading files, opening sockets or setting defaults here.

parent(), config()

These methods return a reference to the attributes by the same name.

print()

Prefered output method.

FIXME this one might move to helper library

_do_sub($thing)

Execute subroutine specified by string $thing or execute $thing directly when it's a CODE ref. It works the same way like Zoidberg executes commands, with the difference it takes the subroutine as base instead of the parent object. It is preferred to use this for "command-like" configuration options.

event($event_name, @_)

This method is called by the parent object when an event is broadcasted for which this plugin is registered.

broadcast_event($event_name, @_)

Broadcast an event to whoever might be listening.

register_event($event_name)

Register for an event by the parent object. When the event occurs, the event() method will be called.

unregister_event($event_name)

Unregister self for event $event_name.

unregister_all_events()

Unregister self for all events, this is by default called by round_up(). It is good practice to call this routine when a plugin signs off.

FIXME this is what _should_ happen -- but events need to get more efficient

registered_events()

List events self is registered for.

help()

Stub help function, to be overloaded. This method should return a string with dynamic content for the zoidberg help system. Static help content should be formatted as a seperate pod file.

round_up()

Is called when the plugin is unloaded or when a sudden DESTROY occurs. To be overloaded, do things like saving files or closing sockets here.

AUTHOR

R.L. Zwart, <carlos@caremail.nl>

Jaap Karssenberg || Pardus [Larus] <j.g.karssenberg@student.utwente.nl>

Copyright (c) 2002 Raoul L. Zwart. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Zoidberg

Zoidberg::Help

http://zoidberg.sourceforge.net