Clear questions and runnable code
get the best and fastest answer
Re: Why CGI::Application?by derby (Abbot)
|on Jan 13, 2004 at 13:32 UTC||Need Help??|
It seems as though all of the benefits of C::A are things that can be accomplished by simply adjusting your coding style; making more blocks of code into subroutines, etc.
Sure that will work.
Hey but wait, darnit, I want to use CGI::Simple instead of CGI ... better write that hook.
Hey but wait, darnit, I want to do some post-processing after the HTML is sent to the client ... better write that hook.
Hey but wait, darnit, I need to get into the process after reading the HTTP stream but before I do my real app stuff ... better write that hook.
Hey but wait, darnit, I need a hook after generating content but before sending the headers ... better write that hook.
Hey but wait, darnit, I need a hook to modify the headers ...
Hey but wait, darnit, I need a hook to override what step is being executed ...
Hey but wait ...
CGI::Application gives all this to me and it's been developed, reviewed and used by a slew of talented and qualified people. You see the authors have given you a framework that makes the easy things easy and the hard things possible. Sure you could do that yourself, but you could also write CGI.pm yourself or for that matter your own interpreter.
To me, CGI::Application did not add a layer of complexity and confusion but actually cleared up a lot of issues when trying to build MVC apps. I always knew templates were the VIEW and application specific modules were the MODEL ... it was that damn CONTROLLER that became a big hairy beast ... well CGI::Application really cleaned up my thought process when it came to MVC. So sure I could have spent weeks, months, years creating my own Application framework ... one that's easy to use for the straightforward cases but also allows me to hook in and change things on the fly or I could spend 15 minutes downloading CGI::Application.
So I say well done Jesse (and all the contributors).