[Dancer-users] Having an environments/test.yml

Simon Wistow simon at thegestalt.org
Tue Apr 12 22:44:29 CEST 2011

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 

package Dancer::TestEnviroment;
use strict;
use Cwd;

sub import {
  my $class = shift;

  $ENV{DANCER_CONFDIR}     = getcwd;  
  unless ($INC{Dancer}) {
    require Dancer;
  Dancer::setting(appdir  => getcwd);


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? 

More information about the Dancer-users mailing list