12 Apr
2011
12 Apr
'11
8:44 p.m.
I want to have some test specific stuff in an environment/test.yml (db username and password, memcache prefixes etc etc). Sounds simple enough except that in order to get it to work I had to write something like this package Dancer::TestEnviroment; use strict; use Cwd; sub import { my $class = shift; $ENV{DANCER_ENVIRONMENT} = 'test'; $ENV{DANCER_CONFDIR} = getcwd; unless ($INC{Dancer}) { require Dancer; Dancer->import(@_); } Dancer::setting(appdir => getcwd); Dancer::Config->load; } 1; and the use that from the top of ever one of my test files. Which seems a little ... long winded. Am I doing something wrong? Is there an easier way to do this?