Hi,

I am trying to use a custom TT filter in a Catalyst app.

In MyApp.pm I use:

'View::TT' => {
PLUGIN_BASE => __PACKAGE__->path_to('lib'),
},

In the lib dir I have a Diverse/NoDia.pm module that looks like this:

package Diverse::NoDia;

use Template::Plugin::Filter;
use base 'Template::Plugin::Filter';

sub filter {
my ($self, $text) = @_;
$text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/;
return $text;
}
1;

In the template I use:

[% USE NoDia = Diverse.NoDia -%]
[% FILTER $NoDia -%]
...
[% END %]

But it gives the following error:

Couldn't render template "plugin error - Can't locate object method "load" via package "D:\web\TranzactiiBursiere\lib::Diverse::NoDia" (perhaps you forgot to load "D:\web\TranzactiiBursiere\lib::Diverse::NoDia"?) at D:/usr/site/lib/Template/Plugins.pm line 215.
"

How can I define a custom TT filter in a Catalyst app?

(I need to filter a text depending on a condition, and I don't know if I can use another method for doing this.)

Thank you.


Octavian


_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to