An Example Plugin

We've already taken a look at what each kind of plugin handles. Now lets take a look at what you need to have a working plugin. The following page contains an example of a working skeleton for a plugin. It shows all the requried elements for a working Bricklayer Plugin. It doesn't really do anything but it will load and run in Bricklayer. A BrickLayer Plugin requires one MetaData hash, and at least the following method and library: The method and libraries are pretty self explanatory. The two use statements make your plugin a proper Bricklayer plugin by using the lib::common::plugin module as a superclass. run() gets called when Bricklayer runs the plugin automatically. This is a required method for any plugins that get loaded when Bricklayer is loaded and are run automatically. Depending on how you use Bricklayer this could be any one of the plugin types so it is advised to use this method in all your plugins as the main execution point.
#---------------------------------------------
# 
# File: default.pm
# Version: 0.1
# Author: Jeremy Wall
# Definition: 
#
#---------------------------------------------
package default;
use lib::common::plugin;
use base qw(plugin);

our %MetaData = (Name => "default",
		Type => "Action",
		Author => "Author",
		Version => "0.1",
		URI => "http://someurl/",
		);

sub run {
	my $self = shift;	
	return "Whee!!!!! my plugin loaded";
}
return 1;
Jeremy Wall 2006-08-21