[cgiapp] CGI::App - creating your own overloaded functions

Ron Savage ron at savage.net.au
Tue Aug 25 17:20:39 EDT 2009


Hi Brad

On Tue, 2009-08-25 at 12:17 -0400, Brad Van Sickle wrote:
[snip]
> For example:  Javascript includes.  I have several JS include files that 
> differ from between modules, and even between runmodes within the same 
> module.  So I need some place to build these include strings in each 
> module that has access get_current_runnmode. 

I looked at run-mode specific JS, and decided: Just Don't Do It!

I adopted a JS library (YUI), and now send all required JS down to the
client in the very first response. Thereafter I use Ajax.

The consequences are that the first page load seems a bit slow for the
user (maybe 300Kb), but that's not really all that much these days.

The big gain of course is that /all/ subsequent responses are lightning
fast, since only data is sent.

The other factor is that any JS feature can be used on any 'page', since
the code has already been sent to the client. And if it hasn't, then the
first page has to be re-done. But that's a tiny issue, and hence the
ongoing maintenance problem of matching JS file to page is thereby
eliminated.

[1] http://developer.yahoo.com/yui/


-- 
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html




More information about the cgiapp mailing list