You are viewing Revision 1 of Developing_Plugins

Developing plugins for Aneuch is easy and fun. Plugins are simple PERL scripts that allow you to extend the feature set of Aneuch.

All plugins will reside in a folder called 'plugins' that lives within the $DataDir. Plugin names will end in either '.pl' or '.pm'. If you want to disable a plugin, simply add '.disabled' (or anything, really) to the end of its name and it will not be loaded.

Plugins should have a hash-bang (#!) line at the very top that points at PERL, normally #!/usr/bin/perl. The next line will say package Aneuch;. Following that should be a line that says push @Plugins followed by a string which contains plugin name, version, and a description and link to plugin homepage. An example would be:

push @Plugins, "<a href='http://aneuch.myunixhost.com/Plugins_PlainHTML'>plainhtml.pl</a>, version 1.0 - Allows the use of plain HTML pages (instead of markup)";

After this, a plugin may begin defining variables and subs as it sees fit.

A plugin may replace a built-in sub by doing the following:
*OldMarkup = *Markup;
*Markup = *NewMarkup;

And then go on to define sub NewMarkup.

Hooks

It's relatively easy to hook in to certain subsystems within Aneuch. For example, if you want to create a plugin that adds some functionality to the administrative back-end, you simply add an entry to the %AdminActions and %AdminList hashes.

%AdminActions defines the action and it's associated subroutine. If you want to create an action called "deleteall" and have it call the sub "DoAdminDeleteAll", you would define it as: $AdminActions{deleteall} = \&DoAdminDeleteAll;

You must then also add an entry to %AdminList so that this feature shows up in the administration back-end. Using our above example, you would create a new entry in the %AdminList hash with the same name as the one you added to %AdminActions. For our example, it would be defined as: $AdminList{deleteall} = 'Delete all pages';


CategoryDocumentation