|Think about Loose Coupling|
Why CGI::Application?by sdbarker (Sexton)
|on Jan 13, 2004 at 11:50 UTC||Need Help??|
sdbarker has asked for the
wisdom of the Perl Monks concerning the following question:
I'm not sure if I'm missing something or not, but I don't see the point behind CGI::Application. I've read the tutorial at perl.com, and I still find the point eluding me.
It seems like some of the biggest points are:
1) Code Reusability.
- Solved by making your code better in the first place, more modular.
2) Most CGI applications are big if/else blocks.
- Solved by the above as well. And isn't using C::A Just kinda like moving all of your if/else blocks into one spot, while adding yet another layer of abstraction to get to them?
- Again, just code better.
What am I missing? Why add what seems like another layer of complexity and confusion, for no real benefit (no offense inteded to the author).
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. You'll still have the big block of C::A setup stuff at the top of your script; why not have an if/else that calls different subroutines.