in reply to Re^4: nested routines, anonymous routines and location dependency
in thread nested routines, anonymous routines and location dependency

Could you get away with the following?

{ my $shared_data; my $inner_sub; sub outer_sub { ... ... $inner_sub->(...) ... ... } $inner_sub = sub { ... $shared_data ... }; }

That would get rid of the bug. (A named sub inside another sub in Perl is a bug in my eyes. The warning is too gentle.)

Note that having any $shared_data makes the function non-reentrant, but you can eliminate that problem by sharing data via parameters.

Update: no warnings 'closure'; with a comment explaining that all shared variables need to be exchanged by parameters or globals would also do the trick. But you're eliminating a very useful check.