Forgive me if this has already been asked/answered (i did a little archive
searching first). 

I am trying to create a select box like so:
(Perl)
# $users is an anon array containing a list of anon hash references 
my $users = $sth->fetchall_arrayref({});
$template->process(\*DATA, {Q => CGI->new, users => $users});

(TT)
[% Q.popup_menu({
   Name    => 'user'
   Values  => [users.first.id .. users.last.id]
   Labels  => { ??? }
}) %]

Basically, i need a way of expressing

my $hashref = { map {$_->{id} => $_->{name}} @$users };

in TT. For the record, i have already solved this problem with:

<select name="users">
[% FOREACH user = users %]
   <option value="[% user.id %]">[% user.name %]</option>
[% END %]
</select>

Thanks and Happy Holidays. :)
jeffa

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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

Reply via email to