Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 54764
Status: new
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.105
Fixed in: (no value)



Subject: ErrorHandling::RequireCheckingReturnValueOfEval false positive on 'return eval'
This example program checks the return value of eval, or at least uses it: #!/usr/bin/perl use warnings; use strict; sub x { return eval '1 + 1'; } x or die; However 'perlcritic --single-policy ErrorHandling::RequireCheckingReturnValueOfEval' flags it: Return value of eval not tested at line 5, column 12. You can't depend upon the value of $@/$EVAL_ERROR to tell whether an eval failed. (Severity: 3) Now, this is a string-form eval, which has a separate policy telling you not to use it. But if the programmer decides to use that construct, code like the above is reasonable enough. The policy should recognize 'return eval "string"' and 'return eval { ... }' as doing something with the return value of eval (even though it's up to the subroutine's caller to check it) and so should not warn in these cases.