in reply to tt2 with perl cgi and a csv file
For what it's worth, I've done a couple of fairly large CGIs (a few thousand lines; almost all template code, which was in turn mostly XHTML, with a dispatch hash and related subs). You break your templates into blocks which can be named or put into vars like you've done above. Then stuff the Template code under __DATA__ and something like-
print CGI::header(); $template->process(\*DATA, $template_data) or warn $Template::ERROR;
Now that that's out there I'd recommend against it. It's okay for standalone, one-off stuff (in fact that's exactly what it's for because all the code is bundled in one file so it's easy to deploy and it's sometimes easier to edit code in one big file than 30 different ones). For stuff with room to grow it's an idea that will come back and bite.
It sounds like you're ready for CGI::Application, Catalyst, and friends. There is a learning curve but those sorts of packages abstract away *so* much many of the messy details (especially Catalyst) that you only realize how awesome it is after doing it manually yourself. Three weeks dedicated to reading docs and writing test code with Catalyst would likely shave at least that much time off a large project done with it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: tt2 with perl cgi and a csv file
by Gokee2 (Acolyte) on Mar 27, 2008 at 20:04 UTC | |
by Your Mother (Archbishop) on Mar 27, 2008 at 20:22 UTC | |
by Gokee2 (Acolyte) on Mar 28, 2008 at 04:24 UTC | |
by Your Mother (Archbishop) on Mar 28, 2008 at 06:28 UTC | |
by Gokee2 (Acolyte) on Mar 28, 2008 at 06:50 UTC | |
| |
by stiller (Friar) on Mar 28, 2008 at 05:24 UTC | |
by Gokee2 (Acolyte) on Mar 28, 2008 at 06:41 UTC |