[Dancer-users] init on first run

Nick Knutov mail at knutov.com
Fri May 20 20:57:21 CEST 2011


Hello all,

what is the best way to do some initialization for some data on the only 
first run? Something like 'before sub', but it should run only on the 
first run of the script instance.

Example of use:

our $first;
before sub {
	# if this is the first run of instance
	# $cache->{statuses} = ... # load some static data from DB

	# I can do
	# _load_cache() unless $first;
	# $first = 1;
	# but this is not beautiful
}

-- 
Best Regards,
Nick Knutov
http://knutov.com
ICQ: 272873706
Voice: +7-904-84-23-130


More information about the Dancer-users mailing list