NAME

List::Filter::Transform::Internal - common operations used by transform methods

SYNOPSIS

# using as a utility object
use List::Filter::Transform::Internal;
my $lftu = List::Filter::Transform::Internal->new();
$term = [ qr{ slimey \s+ boss }x, 'g', 'professional management' ];
$changed_item = $lftu->substitute( $item, $term );


# one way of setting override_modifiers attribute (case insensitve, "i")
my $lftu = List::Filter::Transform::Internal->new( {override_modifiers => 'i' } );

# another way of setting override_modifiers (extended regexps, "x"):
$lftu->set_override_modifiers( 'x' );


# this can be inherited from (deprecated):
use base ("List::Filter::Transform::Internal");
my $changed = $self->substitute( $item, $term );

DESCRIPTION

List::Filter::Transform::Internal is at present a class of utility object, used by the List::Filter::Transforms::* modules, which contain "methods" that are exported to the Dispatcher namespace ultimately.

At present, there is only one object attribute that's important: "override_modifiers" which is used by the "substitute" method.

METHODS

new

Instantiates a new List::Filter::Transforms::* object.

Takes an optional hashref as an argument, with named fields identical to the names of the object attributes.

With no arguments, the newly created filter will be empty.

init

Initialize object attributes and then lock them down to prevent accidental creation of new ones.

Note: there is no leading underscore on name "init", though it's arguably an "internal" routine (i.e. not likely to be of use to client code).

methods internally used by transforms

substitute

Performs a perl s/// on the given string, building up the the substitution from three parts supplied in a an array ref:

(1) a perl regular expression, qr{}; (2) any external match modifiers (e.g. "g", "e"); (3) the replacement string (or expression, if the 'e' modifier is in use).

Some attempt has been made to avoid re-compiling the regular expressions if there's no need to. To take advantage of this, if at all possible, the "ismx" modifiers should be applied when creating the regexp. The "g" and "e" modififiers are the only ones that need to be applied externally. The "o" modifier is silently ignored.

Inputs: (1) the string to be modified (2) a "transform term" (aref, three parts),

Returns: the modified string

Example: $term = [ qr{ slimey \s+ boss }x, 'g', 'professional management' ]; $self->set_override_modifiers( 'x' ); $fixed_item = $self->substitute( $item, $term );

mod_regexp

Given a qr{} value and a set of modifiers (any of xism), returns a qr{} value with those modifiers applied.

Inputs: (1) qr{} (2) string: some sub-set of "xism"

Return: qr{}

(This is an inheritable "method", though it makes no use of object or class data.)

basic setters and getters

override_modifiers

Getter for object attribute override_modifiers

set_override_modifiers

Setter for object attribute set_override_modifiers

SEE ALSO

List::Filter

AUTHOR

Joseph Brenner, <doom@kzsu.stanford.edu>

COPYRIGHT AND LICENSE

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.

BUGS

None reported... yet.