Categories: Web, Catalyst, HTML, Javascript, YUI
Config Catalyst
April 27th, 2009Catalyst Configure Schema
1, App class will load config option into self.
2, Other class query App class about its config option. For example, Model::DB will try to query its option in $config->{Model}->{DB}.
3, Catalyst default uses Config::General to load config from {app_name}.conf
4, Class can setup configure item in its source file by __PACKAGE__->config( {info} ), and this config function will return the current package level configure options.
Local config
By default, Catalyst try to local appname.conf, but it also try to load a local config file: appname_local.conf, which contains high priority value than appname.conf.
The __PACKAGE__->config() has lowest priority.
So use __PACKAGE__->config() to setup default configuration.
Use appname.conf to setup configure wish included into version manager system.
Use appname_local.conf to complete items in release mode.
User can use envoriment variable CONFIG_LOCAL_SUFFIX to change 'local' to other value.
Config::General config format
<name1> will map to a named field: $parent->{name1} = { value inside block }.
<name1 name2> will map to $parent->{name1}->{name2}
name = value will match to name=>value
name = value1 will match to
name = value2name => [ value1, value2 ]
Closure in JavaScript
April 16th, 2009var tag;
var func = function(){
return afunc( tag );
}
is not a correct usage.
The correct one is:
var genFunc = function( ptag ){
var ltag = ptag;
return function(){afunc( ltag )};
};
genFunc( tag );
YUI Test
April 16th, 20091, Add message to Assert statement to make code easy.
2, Use subscribe() listen custom event of TestRunner.
3, Use YAHOO.log() to output log.
4, var Assert = YAHOO.util.Assert to use YAHOO's assert.
A Javascript stacktrace in any browser - Eric Wendelin%u2019s Blog
April 16th, 2009Link: http://eriwen.com/javascript/js-stack-trace/
Nice article.