That object has a method.
It's M E T H O D.
Oh, I love to program everyday
and if you ask me why I'll saaaaaaay
Cuz Andy Wardley has a way with T E M P L A T E.
In my template I want to print the size of that list. If the list is empty I want to print 0.
However, [% obj.method.size %] and [% obj.method.list.size %] both print nothing at all.
What magical incantation can I use to avoid having to set up a macro
just to turn this into a 0? (I'm passing this value around so I can't
even just do [% obj.method.size || 0 %])
In your code:
$Template::Stash::LIST_OPS->{count} = sub {
my ($x) = @_;
my $c = @$x;
return "$c";
};And in your template: [% obj.method.list.count %]
--mark mills
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
