http://qs321.pair.com?node_id=614822

madison.sacd has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am trying to show different title in template.

In my controller list.pm, I assign a type variable to the template.
$c->stash->{type} = 'B';
In the template, according to the type, the metadata "title" will be assigned different value, "Book" or "CD". My problem is that I got correct debug output for each condition. However, "CD" will always be assigned to the metadata "title". In other words, when I pass type 'B' to template, the debug output shows "!!!!!!!!!!", which is correct, but the title displays "CD". Anything wrong with my code?
[% IF type == 'B'; META title = 'Book'; debug("!!!!!!!!!!"); debug(type); ELSE; debug("@@@@@@@@@@"); debug(type); META title = 'CD'; END; -%]