On Sat, Mar 08, 2003 at 01:14:06PM +0000, Andy Wardley said:
> Yes, have the Chump plugin new() method create a Chump and return a
> reference to it. Then you can all the new_type() methods, et al,
> directly.
>
> Also have it call $content->define_filter( chump => sub { } ) to install
> your 'chump' filter sub.
Because I'm using Template::Plugin::Filter I returned $self from init()
and then had a method in Template::Plugin::Chump called new_type wot
looked like
sub new_type {
my $self = shift;
# should probably check for errors here
$self->{_TC}->new_type(@_);
# prevent spurious 1s appearing all over the template
return;
}
then in index.cgi
$vars->{sub} = sub { sub { return uc $_[2] } };
$tt->process($template, $vars);
and in the template
[% USE Chump %]
[% Chump.new_type('equal', '=', sub) %]
et voila, it all works.
Cheers, should eb winging its way to CPAN soon.
Simon
--
the test for truth is still quicker than the addition
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates