On Fri, Mar 05, 2004 at 09:53:27AM -0500, Mark Mills wrote:
> In your code:
> $Template::Stash::LIST_OPS->{count} = sub {
> my ($x) = @_;
> my $c = @$x;
> return "$c";
> };
>
> And in your template:
> [% obj.method.list.count %]
That's not working for me. I'm getting exactly the same results as with
the inbuilt .size - i.e. nothing.
(Code below for testing....)
Tony
________
#!/usr/bin/perl
use strict;
use warnings;
use Template;
use Template::Stash;
$Template::Stash::LIST_OPS->{count} = sub {
my ($x) = @_;
my $c = @$x;
return "$c";
};
my $tt = Template->new;
$tt->process(\*DATA => {
mylist => sub { return () },
});
__DATA__
Size: [% mylist.count %]
Size: [% mylist.list.count %]
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates