Assaf Gordon wrote, On 10/15/2012 11:53 AM:
Stéphane Wenric wrote, On 10/15/2012 03:04 AM:
On Fri, Oct 12, 2012 at 10:51 PM, Assaf Gordon <gordon@cshl.edu <mailto:gordon@cshl.edu>> wrote:
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.
I guess you could always disable warnings locally, before your function call, and re-enable them after. Something like
no warnings;
Unfortunately this doesn't work.
Follow-up: locally disabling SIG{__WARN__} did the trick, eval { local $SIG{__WARN__}; do_something_that_might_fail(); $ok = 1; }; Based on this thread: http://www.perlmonks.org/?node_id=51097 But perhaps a better way is to update Dancer::Route::execute(), to check if we're inside an "eval" block, and if so - not "take over" and show error 500 ? (the "eval" implies that the programmer is aware of the possible failure and wants to handle it?)