Control logic using HTML::Template
Just a couple of quick questions. If I'm writing CGI programs to create web pages via HTML::Template, then do I have to write separate tmpl
files for each distinctive screen (the control logic to be in the Perl code)?
Also, (and in a similar area) is it OK to开发者_高级运维 put url links to the other screen CGI programs within the tmpl
files? For example if one screen displays employee details, could I put a link on the department field to display department details on another screen - I'm guessing I can, but want to know if there are repercussions?
Hmm, maybe they are quick questions, but the answers may be involved, so if anyone knows a good web source that explains this a link would suffice.
The whole point of using HTML::Template is to separate the V (view) from the MC (model and controller) in MVC.
I follow the simple rule of one template file per view. Of course, you can use the <TMPL_INCLUDE>
mechanism to avoid unnecessary duplication.
You can include any links you want in the templates. You are just sending HTML to the browser, anyway.
CGI::Application works well with HTML::Template.
精彩评论