[Dancer-users] Masking warnings with eval/try in development mode?

Assaf Gordon gordon at cshl.edu
Mon Oct 15 17:53:55 CEST 2012


Stéphane Wenric wrote, On 10/15/2012 03:04 AM:
>> On Fri, Oct 12, 2012 at 10:51 PM, Assaf Gordon <gordon at cshl.edu <mailto:gordon at 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
> 
>    eval {
>       no warnings;
>       do_something_that_might_fail();
>       use warnings;
>      $ok = 1;
>    };
> 

Unfortunately this doesn't work.
Perhaps calling it "warning" is the wrong term, because the code in "do_something()" uses "die" (not "warn"),
but adding "no warnings" has no effect - I still get the standard Dancer 500 error page with the stack-trace.




More information about the Dancer-users mailing list