The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

RTx::Shredder::Plugin - interface to access shredder plugins

SYNOPSIS

  use RTx::Shredder::Plugin;

  # get list of the plugins
  my %plugins = RTx::Shredder::Plugin->List;

  # load plugin by name
  my $plugin = new RTx::Shredder::Plugin;
  my( $status, $msg ) = $plugin->LoadByString( 'Tickets' );
  unless( $status ) {
      print STDERR "Couldn't load plugin 'Tickets': $msg\n";
      exit(1);
  }

  # load plugin by preformatted string
  my $plugin = new RTx::Shredder::Plugin;
  my( $status, $msg ) = $plugin->LoadByString( 'Tickets=status,deleted' );
  unless( $status ) {
      print STDERR "Couldn't load plugin: $msg\n";
      exit(1);
  }

METHODS

new

Object constructor, returns new object. Takes optional hash as arguments, it's not required and this class doesn't use it, but plugins could define some arguments and can handle them after your've load it.

List

Returns hash with names of the available plugins as keys and path to library files as values. Method has no arguments. Can be used as class method too.

LoadByName

Takes name of the plugin as first argument, loads plugin, creates new plugin object and reblesses self into plugin if all steps were successfuly finished, then you don't need to create new object for the plugin.

Other arguments are sent to the constructor of the plugin (method new.)

Returns $status and $message. On errors status is false value.

LoadByString

Takes formatted string as first argument and which is used to load plugin. The format of the string is

  <plugin name>[=<arg>,<val>[;<arg>,<val>]...]

exactly like in the rtx-shredder script. All other arguments are sent to the plugins constructor.

Method does the same things as LoadByName, but also checks if the plugin supports arguments and values are correct, so you can Run specified plugin immediatly.

Returns list with $status and $message. On errors status is false.

Rebless

Instance method that takes one object as argument and rebless the current object into into class of the argument and copy data of the former. Returns nothing.

Method is used by Load* methods to automaticaly rebless RTx::Shredder::Plugin object into class of the loaded plugin.