$top_menu = { base_name => 'foo', size => 23 };
And after your code executes, you expect width = 3.03 and extra = 0. Yes?
What your code actually does is something different. To get the base_name element in a top_menu hash in TT, it's top_menu.base_name (no dollar sign). If you say top_menu.$base_name in TT, it's like $top_menu[$base_name] in Perl.
I could be wrong about this, however. I'd expect top_menu.$size to be zero if you haven't set size to anything in particular, so I'd expect 100/top_menu.$size to bomb out as division by zero. Also, the error you're getting isn't really explained by what I'm talking about.
Anyway, I think a Data::Dumper look into your variables might help.
I also wonder if it would help to explicitly say
[%- SET extra = ((100-(width*(top_menu.$size)))/2); -%]
...although I'm not sure why that would help. |