Assuming there are no other references to $foo created, when the eval block in main is exited, Foo::DESTROY() will be invoked, regardless of whether the eval finished normally or not. If the eval in main fails, but the eval in Foo::DESTROY() succeeds, then $EVAL_ERROR will be empty by the time that the if is executed. Additional issues arise if you depend upon the exact contents of $EVAL_ERROR and both evals fail, because the messages from both will be concatenated.

Even if there isn't an eval directly in the DESTROY() method code, it may invoke code that does use eval or otherwise affects $EVAL_ERROR.

The solution is to ensure that, upon normal exit, an eval returns a true value and to test that value:

"But we don't use DESTROY() anywhere in our code!" you say. That may be the case, but do any of the third-party modules you use have them? What about any you may use in the future or updated versions of the ones you already use?