[Petal] cont'd: Dereferencing SCALAR references correctly
Warren Smith
wsmith at platinumtel.com
Mon Jul 19 21:07:43 BST 2004
grr. silly email client......
if you do this:
template.html
-------------
<div petal:content="vals/var1"></div>
program.pl
----------
$var1 = "Hello";
$var2 = "Hello2";
%vals = ( var1=>\$var1, var2=>\$var2);
$tpl = new Petal(...);
echo $tpl->process({vars => \@vals});
Hello and Hello2 are not set. you see SCALAR references.
Changing the last part of Petal/Hash/Var.pm to
# return '' unless (defined $current);
# $current = "$current" if (defined $current);
return $$current if isa($current, 'SCALAR');
return $current;
}
fixes this.
More information about the Petal
mailing list