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
This page was last updated on 2008-09-17, 14:41.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.