List::Filter::Dispatcher -
use List::Filter::Dispatcher; my $dispatcher = List::Filter::Dispatcher->new( { plugin_root => 'List::Filter::Filters', plugin_exceptions => 'List::Filter::Filters::Ext::Nogoodnik', } ); my $aref_out = $dispatcher->apply( $filter, $aref_in );
The Dispatcher object is told where to look for modules that contain the methods that can apply a List::Filter filter. During it's init phase the dispatcher does the necessary requires of each of those method-supplying modules, which must be designed to export these methods to the Dispatcher's namespace.
It's expected that when a new Filter object (or one of it's inheritors) is created, it will be assigned a dispatcher so that it will be able to execute the filter's methods. See List::Filter.
This is part of an extension mechanism to allow the creation of additional filter filter methods that the existing code framework will be able to use without modification.
One advantage of this approach is that each filter object has a default method (accessed via the apply method), and yet it can be applied with a different method if that seems desireable.
For example: an "omit" filter could be inverted to display only the items that are usually omitted.
See "Extension mechanisms"" in "List::Filter::Project for instructions on writing methods, and creating filters that use them.
Instantiates a new List::Filter::Dispatcher object.
Takes an optional hashref as an argument, with named fields identical to the names of the object attributes:
The location to look for the "plugins" that define the actual "methods" that tasks are dispatched to.
A list of modules in the plugin_root that will be ignored.
Note: if you absolutely must use inheritence to create a variant of an existing plugin, the original parent class should be entered in this list to avoid namespace collisions.
Initialize object attributes and then lock them down to prevent accidental creation of new ones.
An internally used routine that loads all of the subs defined in all of the plugins/extensions found in perl's module namespace at or under the "plugin_root" location.
Returns: the number of sucessfully loaded plugin modules.
Applies the filter object, typically acting as a filter.
Inputs: (1) filter object (note: contains an array of patterns) (2) aref of input items to be operated on (3) an options hash reference:
Supported option(s):
"method" -- routine to use to apply filter to input items (defaults to method specified inside the filter).
Return: aref of output items
Note: The options href is also passed through to the "method" routine.
Note: because of the oddities of the current architecture, accessors must be provided for any fields needed by either the Filter or the Transform routines, since those are imported into the Dispatcher namespace, they become Dispatcher methods.
I'm making an effort to document them here, for that reason (though in general I think they should be avoided, period).
Getter for object attribute plugin_root
Setter for object attribute set_plugin_root
Getter for object attribute plugin_exceptions
Setter for object attribute set_plugin_exceptions
List::Filter Module::List::Pluggable
Joseph Brenner, <doom@kzsu.stanford.edu>
Copyright (C) 2007 by Joseph Brenner
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.
None reported... yet.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install List::Filter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm List::Filter
CPAN shell
perl -MCPAN -e shell install List::Filter
For more information on module installation, please visit the detailed CPAN module installation guide.