in reply to Re: Re: Re: mod_perl & TT2 Architecture
in thread mod_perl & TT2 Architecture
One advantage is that if the modules are distributed to others then the amount that they need to type into the httpd.conf file is reduced.
You can't get much shorter than adding Include myproject.conf to your httpd.conf file.
It also means that the module authors get control of the url layout and so can change it without ever changing the httpd.conf file - ie easy upgrades
Anyone who is allowed to write a module that will run under mod_perl should be allowed to change the conf file. The amount of damage that can be done is equivalent, so responsibility should be the same.
Another reason is that you can then ensure that the user has jumped through some hoops before letting them get as far as the next modules. This could be authenticating them or setting up variables based on their preferences.
I normally structure my apps to run some common setup stuff before handling any request. This has nothing to do with the conf file -- you just make your apps use a common base, like CGI::Application or Maypole. Auth stuff, on the other hand, belongs in the conf file. Apache has a built in phase for dealing with it that allows you to easilly change the auth system and permissions for specific apps. This is much harder to modify if you shove it all into your main application code instead.
Also the layout does not need to come from a hash, it could come from an XML file.
How would that be better than httpd.conf? It's not quite XML, but it's close. It's actually less verbose than XML would be.
Finally it allows the _possibility_ of running the same code as a plain CGI
It actually makes this no easier or harder than it would be if you did the mapping in the conf file. You can map to CGI scripts just as easilly as you can to handlers.
Finally, there is value in doing things the standard way. No one on earth knows how to set things up using the private configuration method you just invented. Tons of people know how to set up an Apache conf file. That is valuable in itself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: mod_perl & TT2 Architecture
by EvdB (Deacon) on May 26, 2004 at 07:51 UTC |