* Jose Luis Martinez <[EMAIL PROTECTED]> [2002-07-18 06:50]:
> Hi.
> 
> I'm accessing a hash with TT that has some predfined keys, such as
> 'background-color' or 'text-family' so that they match with CSS
> styles.
> 
> when I do this:
> [% hash.background-color = 'black' %]
> I get a parsing error. (unexpected token (=)). I think TT is trying to
> evaluate the minus first.
> is there a workaround for this?

This works for me, using one of the examples you posted:

  $ perl -MTemplate
  my $t = Template->new;

  my %params = (
    "hash" => {
        "background-color" => "black",
    },
  );

  $t->process(\*DATA, \%params) or die $t->error;

  __DATA__

  [% g = "background-color" -%]
  [% hash.$g %]
  [% hash.$g = "white" -%]
  [% hash.$g %]

  black
  white

I'm running TT from CVS; what about you?

(darren)

-- 
Morality works best when chosen, not when mandated.
    -- Larry Wall


Reply via email to