NAME

Plugin.pm - Base Class For GEM Plugins

USAGE

This Document Describes how plugins work and how to write them.

Plugins are the objects within the generic enterprise manager that perform all the functionality. This class provides core functionality and is inheirited by .pm files that reside in the plugins subdirectory. This is the documentation on how to write a plugin.

SYNOPSIS

Generic Enterprise Manager plugins are written to provide users features through the GEM. A plugin is a perl module (extension .pm) that inheirits from the base class Plugin. The .pm file and a .xml file which identifies associated data (author, copyright notice...) are placed in the plugins subdirecory of the application where they will automatically be loaded at run time. Plugins should conform to this specification. If a plugin does not compile, it not loaded at run time ( you will see error messages ). Plugins are called by and run from the PluginManager module.

TOP OF FILE

It is recommended that the top of a plugin file named xyz follow the following template:

        package xyz;
        @ISA = qw(Plugin);
        use strict;
        use vars qw($VERSION);
        $VERSION = ".01";

BOTTOM OF FILE

As with all perl modules, the plugin must return a 1 and of course you are encouraged to embed embed perldoc documentation after that line.

  1;
  __END__
  =head1 NAME
  eventviewer.pm -  Module for viewing events
  =head2 DESCRIPTION
  The event viewer can be viewed as an example plugin.
  etc...

OTHER FUNCTIONS

After that, the plugin should contain subroutines that override the subroutines in its parent Plugin.pm. These will be used to define user interface elements and to handle functionality. You can create and paint a notebook tab if you wish to use one. You can create explorer buttons (lower left side), bitmaps for the upper left side, can add items to the main explorer tree, and can create the functionality that occurs when you right click items on an element of that tree. You can also create menu items for the menu bar. The heirarchy is that the explorer buttons, when clicked, will populate the explorer tree. The tree is painted and right click items added to elements. When a user selects an element on this tree, selects a menu item, or right clicks on one of the right click items, a call back to event_handler() will be performed.

PLUGIN BUILTIN FUNCTIONS

This section lists functions that your plugin must NOT override. These are automatically called from GEM. In other words... theses functions should not be defined by the plugin.

PLUGIN UTILITY FUNCTIONS

The following functions are available to you to use in your plugin:

PRINT FUNCTIONS

You also have 3 print functions.

The following example line will set the statusbar and print to stdout

        $package->statusmsg( "[navigator.pm] menuclick($menuitem)\n" );

PLUGIN CALLBACKS

The callbacks define the look and feel of the application. The buttons on the lower left side determines which tree is selected in the explorer type menu above it. This function returns an array of buttons to place in that corner.

PLUGIN DOCUMENTATION

Plugin documentation is contained in an xml file in the plugins directory that has the same root name as the .pm file. I suggest you browse a few of them for functionality.

 <package name="MDA_tables" version=".01">
   <copyright type="gpl" key="" expires="never" notice="copyright (c) 2005 by edward barlow" />
   <help_url>http://www.edbarlow.com/plugins/MDA_tables.html</help_url>;
   <long_description>Monitoring Table Viewer</long_description>
   <short_description>Monitoring Table Viewer</short_description>
   <author_name>Edward Barlow</author_name>
   <author_mail>barlowedward@hotmail.com</author_mail>
 </package>

Event Functions

GEM communicates with the plugins using the function $pluginname->send_event(%args). This function sends the event to each event_handler() function in loaded plugins. These functions, on a plugin by plugin basis, will handle the event.

Fixed Reactions

Clicking on the buttons in the lower left corner will always redraw_tree() in addition to anything else you want it to do.