1. The script from the Cookbook <https://metacpan.org/pod/release/XSAWYERX/Dancer2-0.08/lib/Dancer2/Cookbook.pod#From-a-separate-script> : # bin/script2.pl use FindBin <https://metacpan.org/pod/FindBin>; use Cwd <https://metacpan.org/pod/Cwd> qw/realpath/; use Dancer2 <https://metacpan.org/pod/Dancer2>;
#tell the Dancer2 where the app lives my $appdir=realpath( "$FindBin::Bin/.."); Dancer2::Config::setting('appdir',$appdir); Dancer2::Config::load(); #getter print "environment:".config->{environment}."\n"; #development print "log:".config->{log}."\n"; #value from development environment fails with: Undefined subroutine &Dancer2::Config::setting called at script2.pl line 9. Although I can see a setting function in Dancer2::Core::Role::ConfigReader? 2. What's the best way for my perl modules to access settings? eg. if Main.pm says: my $foo = myApp::FooMaker->new(); FooMaker.pm can get config settings via: a) Using an approach similar to the above b) Having all config or specific parts of config passed in since FooMaker is Dancer2 unaware. Does adding: use Dancer2; to FooMaker make it Dancer2 aware? (ie. give it access to all the Dancer environment?) and if so, what kind of Dancer2 environment does one need to make for unit tests of FooMaker functions/methods? thanks, Nathan
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users