package test_setup; sub setup { # ... } BEGIN { # must be after the sub definition setup(); $ENV{USE_TEST_DB} = 1; } 1;