I've written a website in Perl. It has a root handler, that all HTTP requests are sent to.
This root handler then processes the request, and things like cookies, POST and GET vars, etc, then chooses a sub-handler and forwards the request on to that.
Because the root handler includes all the sub handlers, and all the sub handlers include all the modules they require, I'm basically processing the entire code base on every request. If we weren't using mod_perl I'd be a bit concerned about this.
But is this still the wrong way to do things? Should I remove the root handler and jump straight to the sub handler?
Than开发者_StackOverflow中文版ks
If some other instance of your website might have to be run in a non mod_perl environment, then I'd see this as an issue. If you were running CGI, each handler should be its own CGI script, and load only the modules it needs - you might even want to load some of those modules dynamically at runtime depending on the frequency with which it's used.
But in mod_perl, the approach you have seems best.
精彩评论