.: Local index.pl ./Local: MyPlugin.pm #### #! /usr/bin/perl use strict; use warnings FATAL => 'all'; use CGI; use Template; my $tt = Template->new( { PLUGIN_BASE => 'Local', } ); print CGI->new->header; $tt->process( \*DATA, { msg => 'Seems to work' } ) or die $!; exit; __DATA__ [% USE MyPlugin %] [% msg %]

[% msg | make_red %]

##
## package Local::MyPlugin; use base qw(Template::Plugin); use strict; use warnings FATAL => 'all'; sub new { my($self, $context) = @_; $context->define_filter( 'make_red', \&make_red, 0 ); return $self; } sub make_red { my $input = shift; return '' . $input . ''; } 1;