[Dancer-users] Custom FILTERS for TemplateToolkit in dancer?

Assaf Gordon gordon at cshl.edu
Thu Oct 13 01:06:11 CEST 2011


Has anyone managed to add a custom Template-Toolkit Filter when using Dancer ?

Using TT directly, the code would looks like this:
sub my_custom_filter {
	my $text = shift ;
	## Do something  to $text;
	return $text;

my $tt = Template->new( {
	FILTERES => { 'my_custom_filter' => \&my_custom_filter }

Using Dancer, I see the TT->New() call is in "Dancer/Template/TemplateToolkit.pm",
and I could even possibly add configuration options using "config.yml", but how do I specify a reference to a sub in my code ?

Any suggestions will be appropriated,


More information about the Dancer-users mailing list