Perl-Sensitive Sunglasses | |
PerlMonks |
CGI::Application, Template Toolkit and global parametersby Fang (Pilgrim) |
on Nov 06, 2005 at 11:23 UTC ( [id://506098]=perlquestion: print w/replies, xml ) | Need Help?? |
Fang has asked for the wisdom of the Perl Monks concerning the following question: Hello Monks, I am currently discovering the bliss that is CGI::Application, though I have just bumped into a small issue. Using CGI::Application::Plugin::TT, I built a nicely running start of my project. After I had 4 run modes, I wanted to make the navigation between them and future modes easier with the addition of a simple menu at the start of every page. Here are the related config and template files:
So, the heart of the problem is how I can fill the main_menu.tmpl template. At first, I thought about using constants, adding the definition of the menu to the TEMPLATE_OPTIONS hashref, but it didn't work.
This results in a list with only one item, 'foo!'. I didn't read anything in the Template Toolkit doc about user-defined constants needing to only be strings or numbers, but I guess it has to. I then tried another way:
That last one works as expected, however I wouldn't be posting here if I didn't have any question, so are there other, more standard ways of doing what I'm trying to achieve? Or anything I missed about the usage of user-defined constants in TT? Thank you for your time and help.
Back to
Seekers of Perl Wisdom
|
|