Plugin Development Notes.

GNUMP3d Plugin Support

GNUMP3d now has support for external plugins, which are Perl modules loaded upon demand by the server when incoming requests are recieved.

The plugins may extend the server by handling the processing of a given URL. When an incoming request is made each of the loaded plugins is given the opertunity to handle it, if none does so then the request is handled by the server proper.

Included with each release are several 'core' plugins - these plugins are all considered to be part of the core of the server, because they're linked to from the included templates. However if you wish to remove them you're entirely welcome to do so.

Core plugins include:

How it all works

Currently the plugin system is rather simplistic, it assumes that the name of a plugin matches the path upon the server which it handles.

For example a plugin to handle the path "/stats/" must be called "stats.pm".

This will change in the near future - although I will ensure that all user contributed plugins are updated to work with the new system when it is ready.

Creating A Plugin

This is the simple overview for creating a plugin, there's a more detailed plugin creation tutorial if you'd like step by step instructions.

In brief a plugin is a Perl Module which lives in the 'lib/gnump3d/pluguins/' directory. (Note that the plugin directory can be changed from the configuration file, or the command line).

To add a new plugin simply create the file 'lib/gnump3d/plugins/foo.pm', making sure that you include the required functions.

Your plugin will be called once for each incoming request which matches the path it handles, where it will be assumed that the request was handled..

Have a look at the source to the included plugins for more details, 'COPYING.pm' is the simplest plugin, (it just displays the GNU General Public License, regardless of how it was called).


1. I need to plan plugin priorities. What should happen if multiple plugins all claim a given path?

2. Could plugins be called for more than just regexps on the request path?