|Think about Loose Coupling|
Re: Re: Re: Re: Re: mod_perl & TT2 Architectureby EvdB (Deacon)
|on May 26, 2004 at 07:51 UTC||Need Help??|
This debate could go on for ages. Let me say that I do agree with you and am playing devil's advocate to some extent. The point I am trying to make is that in some situations the standard way of doing things is not always the best.
I'll try to get this across by looking only at the first point - that putting the dispatch stuff in the main module can be a good idea for 'blackbox' apps.
The imaginary scenario: I have a blog app which runs under mod_perl. It is intended that the sys admin need only run perl-MCPAN -e 'install UberBlog' and then add this to their httpd.conf file:
Even the most novice sys-admin should be able to do that, and would then be able to forget about it as long as it all worked. When it comes to upgrading all she need do is run perl -MCPAN -e 'install UberBlog' again and it will all work.
If the user wants to dig into the internals then the name of the handler should give them a good clue as where to start.
All of the above could have been put into 'uberblog.conf' and then 'Include'd as you suggest, but then this file would have to be located on the filesystem somewhere and it would not be possible to upgrade it when the module got upgraded. This adds complexity that the user does not want. It could also couse real trouble if another admin on the same machine decides to upgrade the modules.
I think that there is merit in putting a fair amount of stuff in the main handler and running the show from there. There is also plenty of merit in not doing that though... I hope have have won you over to some extent with regards to the above scenario.