[Dancer-users] Masking warnings with eval/try in development mode?
Assaf Gordon
gordon at cshl.edu
Fri Oct 12 22:51:39 CEST 2012
Hello,
I'm working on a website, currently in 'development' mode.
The config has "warnings: 1", meaning "treat warnings as critical errors", which is what I want 99% of the time.
However,
there's one place were I want to try something that might fail, and proceed without stopping the dancer application.
Something like:
===
get '/foobar' => sub
{
my $ok;
eval {
do_something_that_might_fail();
$ok = 1;
};
template 'foobar', { ok => $ok } ;
};
===
However, in development mode with "warnings: 1", the "do_something" die()s and the dancer application stops with the standard HTTP 500 page with the stack trace.
I don't want to turn "warnings" off, but I want to be able to mask this specific warning.
Any ideas ?
Thanks,
-gordon
More information about the Dancer-users
mailing list