On Tue, 19 Oct 2004 12:10:20 -0700, Sean Kellogg
<[EMAIL PROTECTED]> wrote:
> Whenever I have passed an array like yours, I have found it best to push an
> anonymous hash like this
> 
> push @emails, { from => "fred", to => "wilma", subj => $subj , date => 
> "today"};
> 
> and then pass the array to the template with a slash.
> 
> my $vars = {
>         message  => "Hello World\n",
>         emaillist => [EMAIL PROTECTED]
> };

That solved it magnificently! Now i'm trying to clean it up so I don't
have to specify the fields and I can cut and paste more code ...so. I
wrote this using what I've learned. This snip works, but I don't think
it's correct. I think there is a perl fudge making it work ;)

   while (my $rowref = $sth->fetchrow_hashref) {
       foreach (my $href = $rowref) {
           my %result = %{ $href };    
           push @notes, \%result;
       }
   }

This way, in the template I can just use the database fields. eg,
timestamp, id, param1, etc.
--

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

Reply via email to