Created
December 31, 2014 11:43
-
-
Save SysPete/7e4a0449dac37c4d427e to your computer and use it in GitHub Desktop.
dev.pl for using querylog middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Plack::Builder; | |
use Plack::Middleware::Debug::DBIC::QueryLog; | |
use Plack::Middleware::DBIC::QueryLog; | |
use Dancer; | |
use Dancer::Plugin::DBIC; | |
use Dancer::Handler; | |
use lib 'lib'; | |
use DanceShop; | |
my $app = sub { | |
load_app "DanceShop"; | |
Dancer::App->set_running_app("DanceShop"); | |
my $env = shift; | |
my $schema = schema->clone; | |
my $querylog = | |
Plack::Middleware::DBIC::QueryLog->get_querylog_from_env($env); | |
$schema->storage->debug(1); | |
$schema->storage->debugobj($querylog); | |
Dancer::Handler->init_request_headers($env); | |
my $req = Dancer::Request->new( env => $env ); | |
Dancer->dance($req); | |
}; | |
builder { | |
enable 'Debug', | |
panels => [ | |
'Parameters', 'Dancer::Version', | |
'Dancer::Settings', 'Dancer::Logger', | |
'Dancer::TemplateVariables', 'DBIC::QueryLog', | |
]; | |
mount "/" => $app; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment