NAME

Text::Modify::Rule - Modification rule, which can be used to process a Text::Buffer object.

SYNOPSIS

use Text::Modify::Rule;

my $rule = new Text::Modify::Rule();

DESCRIPTION

Text::Modify::Rule is a specific modification rule, to be applied for a Text::Modify object.

my $rule = new Text::Modify::Rule();

Text::Modify uses Text::Modify::Rule to process the internal Text::Buffer object, representing the to be modified text.

Methods

new
$rule = new Text::Modify::Rule(%options);

This creates a new rule object, to be used with Text::Modify and perform the supplied modification tasks on the Text::Buffer object.

# TODO lots of documenation missing for options to new

process
my $changes = $rule->process($textbuf);

Process the Text::Buffer object with this rule. Returns the number of modifications performed on the text. Each operation (add, replace, delete) is counted as a modification.

getModificationStats
my ($match, $add, $del, $repl) = $rule->getModificationStats();

Returns to number of matches found, lines added, lines deleted and the number of replacements performed.

isError
getError
if ($rule->isError()) { print "Error: " . $rule->getError() . "\n"; }

Simple error handling routines. isError returns 1 if an internal error has been raised. getError returns the textual error.

BUGS

There definitly are some, if you find some, please report them.

LICENSE

This software is released under the same terms as perl itself. You may find a copy of the GPL and the Artistic license at

http://www.fsf.org/copyleft/gpl.html
http://www.perl.com/pub/a/language/misc/Artistic.html

AUTHOR

Roland Lammel (lammel@cpan.org)