CGI Development - Multiple Entry or Dispatch

David Dick david_dick at
Mon Nov 4 13:02:02 CST 2002

on a side note, how many people actually use 'real' PerlHandlers for 
their web applications and how many develop CGI scripts and smack 'em 
along with Apache::Registry?  i just like using Apache::Registry because 
it lets me debug in a more controlled fashion and it's more portable (to 
what i don't know :)).  Anyone prefer using the 'real' PerlHandlers?

Paul Fenwick wrote:

>G'day Scotty / Melb.PM,
>	Golly, my answer to this question is a great big "it depends".
>If the project involves mod_perl or CGI::Fast, then the dispatch
>mechansim as some obvious advantages.  Modules only need to be
>loaded once, 
i thought that mod_perl meant that regardless of how many times a module 
was used, it was only loaded once?

>a single database connection can be used, 
doesn't Apache::DBI type solutions solve this regardless of whether 
multiple entry/dispatch is being used?

>and data
>can be cached between requests.
don't understand this one either. sorry. :) could you give an example of 
why you can't cache with the multiple entry points?

>	Of course, if your various functions have little overlap
>with each other, then you may only have a negligible speed saving
>from using dispatch vs multiple methods.  Outside of a mod_perl/fastcgi
>environment, dispatch becomes slower as there's more code to
>load in and parse.
>	At the end of the day, unless one method gives you a
>*significant* saving or advantage over the other, then I can't
>say I have an opinion either way.  I've personally used both
>methodologies, and continue to do so.  Usually I'm aiming for
>whichever approach gives the most clean, maintainable, and efficient
>code.  Most of the time I use both methods -- dispatch for
>closely related features, and multiple entry for widely
>separated ones.
>	All the best,
>		Paul

More information about the Melbourne-pm mailing list