On Tue, Sep 14, 2004 at 01:05:11PM +0100, Paul Makepeace wrote:
> I have data like,
>   [ { name => "foo", type => "bar" },
>     { name => "baz", type => "bar" },
>     { name => "arf", type => "bat" },
>     # ...
>   ]
> Is there a way/vmethod to pull out all the names in Template `a la,
>   join " ", map $_->{name}, @data?

You could do something like:

        MACRO map_method_join(data, method, joinchar) BLOCK;
                DEFAULT joinchar = " ";
                mylist = [];
                mylist.push(thing.$method) FOREACH thing IN data;
                mylist.join(joinchar);
        END;

Tony

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to