* Wassim M. <[EMAIL PROTECTED]> [2002-12-17 12:20]:
> Hello Everyone,
Hello,
> sub display_report {
> ###############################################################################
> ## Displays the current report page, the page to display is passed
> ###############################################################################
>
> my @keys = keys(%updates);
> print "@keys\n";
>
> my @values = values(%updates);
> print "@values\n";
>
> print "<P>Start report printing....";
> my $file = $_[0];
> my $vars = {
>
> "data" => %updates
^
"data" => \%updates,
> };
>
> my $template = Template->new({
> INCLUDE_PATH => '/usr/www/users/wassimk/projects/ds/templates',
> });
>
> $template->process($file, $vars) || die $template->error("Cant open file.");
>
> exit;
>
> }
>
> In the template I'm trying to retrieve the data by doing:
>
> [% data.shopperID %]
> [% data.q10a %]
> etc... etc...
>
> I've made sure that those keys I'm trying to get data from are not
> empty. Again, I appreciate any help.
You almost had it -- in Perl, the values of a hash have to be scalar
varaibles, which includes references. So, passing a reference to
%updates (using the \) instead of %updates, will do the trick.
Besides, it's what TT is expecting anyway. :)
What your original code was doing was make a hash that looks like:
$vars = {
"data" => "shopperid",
"1" => "q12a",
"1" => "q12b",
"errer" =>
}
and so on.
(darren)
--
What is truth, on the experiential level, but truthfulness?
-- Raimundo Panikkar
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates