Text Filter Handler
The text filter handler is simple. It takes a single argument as input: the text being transformed. It then is responsible for returning the transformed text.
The example below works by converting all instances of the word "cat" with "dog."
package Example::Plugin;
use strict;
sub mytransform {
my ($str) = @_;
$str =~ s/\bcat\b/dog/mg;
return $str;
}
1; # Every module must return true
- Previous: Text Filters
- Next: Conditional Text Filtering

Leave a note
Have a question, please use the MT Forums. Notes sumbitted here should pertain to tips & hints regarding documentation. Your note may be removed once it's contents has be integrated into the body of the page.