Subject: | ProhibitExitInSubroutines versus blocks |
Date: | Thu, 05 Feb 2009 10:20:26 +1100 |
To: | bug-Perl-Critic [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
In the current cvs BuiltinFunctions::ProhibitExitInSubroutines seems to
be tickled by an exit within a block.
A exit in a conditional block in a script would be pretty common, and I
even quite like to have unconditional blocks with an exit for ease of
cut-and-paste when changing things around. Failing cases below.
Index: ProhibitExitInSubroutines.run
===================================================================
--- ProhibitExitInSubroutines.run (revision 3103)
+++ ProhibitExitInSubroutines.run (working copy)
@@ -13,6 +13,8 @@
exit;
exit if $condition;
$codition || exit();
+if ($condition) { exit 1; }
+{ print "local stuff\n"; exit 1; }
#-----------------------------------------------------------------------------