[Templates] register vmethods?
Marc Chantreux
marc.chantreux at biblibre.com
Mon Jul 28 12:07:40 BST 2008
hello,
I tried to register a vmethod to an object using this way:
use strict;
use warnings;
use Template;
use Template::Stash;
$Template::Stash::SCALAR_OPS->{field} = sub {
my $self = shift;
$self->field(@_);
}
but it doesn't work: $self can't be a reference to be handled by
SCALAR_OPS.
I have 2 questions about it:
i use Template::Stash, so i guess that XS isn't used anymore in my
script so i lost performance. is it right?
is it a way to handle a vmethod for an object without using USE or
declare anything (everything is done in the perl code)?
I just want something as simple as
[% notice.field('99'); %]
--
Marc Chantreux
BibLibre, expert en logiciels libres pour l'info-doc
http://biblibre.com
More information about the templates
mailing list