ryan has asked for the
wisdom of the Perl Monks concerning the following question:
I've recently discovered HTML::Template and am very happy with what it can do for me. In an effort to learn more I am modifying several previous CGI scripts I made when I didn't know about templating.
One of these scripts is a single CGI that has about 10 'faces', depending on the POST data it displays a totally different interface, such as Admin, File List, Reports etc... The CGI could be split up, but I prefer it in one neat file .. I suppose this is another topic, is cramming heaps into the one file frowned upon? I realise this is a bit of a pandora's box :) It is basically a small file management system in a single file.
I was after some guidance as to the best way to handle this using templates. I so far have thought of making a separate template file for each 'face' and putting a simple conditional IF block in the beginning of a 'generic' HTML template that then imports the specific template required for that face. This method would allow me to still maintain a single CGI file, but keep the multiple 'faces' of the CGI, while still having good code/design separation.
Would this be considered workable? Any thoughts or accepted standards in this area?
TIA .. Ryan