List::Filter::Transform - lists of find-and-replace operations
use List::Filter::Transform; @terms = ( [ 'subroutine', 'gi', 'method' ], { 'field', 'gi', 'attribute' ], { 'functional', 'gi', 'not broken' ], ); my $filter = List::Filter::Transform->new( { name => 'oop_up_docs', terms => \@terms , description => "Hunt and destroy passe jargon in docs for spiffy OOP code.", modifiers => "gi", # redundant with settings in @terms } ); # Letting method default to 'sequential' # If non-standard behavior is desired in locating the methods via plugins my $filter = List::Filter::Transform->new( { name => 'oop_up_docs', terms => \@terms , description => "Hunt and destroy passe jargon in docs for spiffy OOP code.", modifiers => "g", method => "reverse", plugin_root => "List::Filter::Transform::Internal", plugin_exceptions => ["List::Filter::Transforms::NotThisOne"], } ); # alternately my $filter = List::Filter::Transform->new(); # creates an empty filter my @terms = [ [ 'find_me', 'i', 'replace_with_this' ], [ 'function', '', 'method' ], [ 'variable', '', 'attribute' ], [ 'Function', '', 'Method' ], [ 'Variable', '', 'Attribute' ], ]; $filter->set_name('oop_up_docs'); $filter->set_terms( \@terms ); $filter->set_method('sequential'); # typical $filter->set_description( "Hunt and destroy passe jargon in docs for spiffy OOP code."); $filter->set_modifiers( "g" ); # 'g' applied, uh, 'globally'
A "transform" is like a List::Filter "filter" (List::Filter), except that each pattern has an associated replacement expression. A "transform" is essentially a list of perl substitutions ("s///").
At the core of a transform object is the "terms" attribute, an array of arrays of three values:
(1) a perl regular expression, (2) external match modifiers (e.g. 'g'), (3) the replacement expression to substitute for a match
Note: future versions of this code may have support for (4) (optional) a hashref of miscellanious transform attributes.
As with "filters", each transform has a "method" field which specifies how the transform will be used by default. It is expected that applying the substitutions in sequence will be used so frequently, that the default method itself defaults to "sequential".
Valid methods are defined in the List::Filter::Transforms::* modules, by default. And alternate location can be selected with the "plugins_tree" argument, and plugin modules in the tree can be selectively ignored if named in the "plugin_exceptions" array.
As of this writing, the only standard supported transform method is "sequential".
Instantiates a new List::Filter::Transform object. Inherits from List::Filter.
Initialize object attributes and then lock them down to prevent accidental creation of new ones.
Note: these accessors are all inherited from List::Filter
Getter for object attribute name
Setter for object attribute set_name
Getter for object attribute method
Setter for object attribute set_method
Getter for object attribute description
Setter for object attribute set_description
Getter for object attribute terms
Setter for object attribute set_terms
Getter for object attribute modifiers
Setter for object attribute set_modifiers
Getter for object attribute dispatcher
Setter for object attribute set_dispatcher
List::Filter List::Filter::Project
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.