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