Tere! I have a little intranet app (in development environment with Dancer's webserver), which fails to connect to database, when it is unused some hours. When on morning first user tries to get some page, he gets "before filter error": runtime error An error occured while executing the filter named before: DBD::mysql::db selectrow_array failed: MySQL server has gone away at /usr/local/lib/site_perl/My/Settings.pm line 136. Pointed line contains a query, which executes fine, when database connection is available (read: after restarting app). My app's main module logic is like this: package My; use 5.010; use Dancer ':syntax'; use Dancer::Plugin::Database; use Dancer::Plugin::EscapeHTML; use utf8::all; use My::Settings; use My::Tools; our ($my_settings, $dbh) = (); $dbh ||= database; $my_settings = get_settings('prod'); my $my_tools = My::Tools->new ( dbh => database, settings => $my_settings, ); hook 'before' => sub { $my_settings = get_settings('prod'); }; sub get_settings { my $env = shift; my $my_settings = My::Settings->new ( dbh => $dbh, env => $env, ); return $my_settings->{settings}; } In before hook i ask dynamic settings from database. Is there better way to do this. Or other solutions? TIA! -- Wbr, Kõike hääd, Gunnar