in reply to Closure warning with Perl 5.14?
You can get that warning from the following even before 5.14:
use strict; use warnings; sub foo { my ($x) = @_; return sub { eval 'print "$x\n";' }; } sub bar { my ($x) = @_; return sub { $x if 0; eval 'print "$x\n";' }; } foo("foo")->(); bar("bar")->();
(Note: The if 0 just avoids a void context warning. Removing it doesn't change the outcome.)
That you also get it in 5.14 under some circumstances involving illegal code (my ... if ...;) is not a problem.
|
|---|