0

I am trying to use Plack::Middleware::DBIC::QueryLog inside of a dancer application. The documentation tells me to get the querylog like this:

use Plack::Middleware::DBIC::QueryLog;
sub get_querylog_from_env {
  my ($self, $env) = @_;
  Plack::Middleware::DBIC::QueryLog->get_querylog_from_env($env);
}

In my dancer app before accessing my database schema I have to set $schema->storage->debugobj to the QueryLogger. My question is: How can I access the environment $env provided by Plack which contains the QueryLog object I'm supposed to use?

I am starting my dancer application with

plackup bin/app.pl

where app.pl contains the default

use Dancer;
use app;
dance;
Kungi
  • 1,477
  • 1
  • 18
  • 34

1 Answers1

1

Have you tried

request->env();

from within your app.pm itself? See Dancer::Request. It's not a Plack::Request object, but judging from the source, it does contain PSGI ENV vars.

oalders
  • 5,239
  • 2
  • 23
  • 34
  • Thats it thank you. I thought I thouroughly read the Dancer::Request documentation. I somehow must have missed this obvious feature. Thank you! – Kungi Jan 31 '13 at 21:22