Hi gvim

On Tue, 2011-05-24 at 04:15 +0100, gvim wrote:
> If I have a collection of, say, 15 fairly lengthy Perl scripts and I convert 
> them into a CGI::Application app with 15 runmodes isn't there a huge startup 
> penalty since my app must now load the code for all 15 runmodes prior to 
> dispatch? Is there a way to lazy-load my runmodes? Although I have each one 
> contained in a separate module I still have to 'use' all of them at once when 
> the app starts.

You don't have to use or load them all. If you adopt
CGI::Application::Dispatch and a MVC structure, only 1 controller module
gets loaded, and hence only the run modes in that module get loaded.

There are plenty of modules on CPAN which use this method.

Mine include App::Office::Contacts, App::Office::CMS,
Business::Cart::Generic and CGI::Application::Demo::Dispatch (hint).

Of course, if you run them under plack or Starman, they are permanently
resident anyway, so the startup overhead is only incurred once.

All the above modules include a plack/starman runner httpd/*/*.psgi
using C::A::D.

-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to