WWWdb::Plugin - Plugins for WWWdb

- NAME
- SYNOPSIS
- DESCRIPTION
- The Plugin class
  - Note
  - Class Methods
  - Class Attributes

# NAME

WWWdb::Plugin - Plugins for WWWdb

# SYNOPSIS

     use WWWdb::Plugin;

     $oPlugin   = Plugin->new($cName,
                              ["HasPrePost" => $bHasPrePost,]
                              ["HasMy"      => $bHasMy]);

     $cResult   = $oPlugin->Call(@lParams);

     $bResult   = $oPlugin->IsDefined($cType);

     $cName     = $oPlugin->getName();

# DESCRIPTION

# The Plugin class

Plugins are one of the base-technology, which makes WWWdb so flexible. It allows the user, to plug in his own modules before, after and/or instead of the system-routine.

An example demonstrates, how this works. Lets assume we have a subroutine named Plugin. If we want to add functionality, before this routine is called we need a own plugin called PrePlugin. For additional functionality after the call of the Routine we have to define a routine called PostPlugin.

But what, if we want to replace the default plugin completely? Ok, then we must define the subroutine MyPlugin. If it is defined, this subroutine instead of the original Plugin is called.

## Note

Currently the plugins are expected in the main:: name-space.

## Class Methods

new

       $oPlugin   = Plugin->new($cName,
                                ["HasPrePost" => $bHasPrePost,]
                                ["HasMy"      => $bHasMy]);

  With this method, a new plugin can be allocated. The Name-Parameter contains the base-name of the subroutines. The HasPrePost and HasMy-parameters control, what types of plugins are searched, the defaults are 0.

Call

       $cResult   = $oPlugin->Call(@lParams);

  Calls the plugins, depending on the Has...-flags given at creation time and the availability of the subroutines. The results of the subroutines are concatenated and will be returned. The given parameters were evaluated and passed to the plugin-routines.

IsDefined

       $bResult   = $oPlugin->IsDefined($cType);

  Checks for this plugin, if a subroutine for one of the specified types Pre, Post, My or Default is defined. If it is, 1 is returned; 0 if not. For any other types undef will be given back.

## Class Attributes

Name

       $cName = $oPlugin->getName();

  The base-name of this Plugin. (Read-only)

HasPrePost

       $bHasPrePost = $oPlugin->getHasPrePost();

  True, when this Plugin could have a Pre- or Post-Plugin. (Read-only, private)

HasMy

       $bHasMy = $oPlugin->getHasMy();

  True, when this Plugin could be replaced by a My-Plugin. (Read-only, private)