I looked at the page mentioned, and I guess I'm too dense today to get it. The explanation of
"An inner (nested) anonymous subroutine is inside a named subroutine, and outside that is another subroutine; and the anonymous (innermost) subroutine is referencing a lexical variable defined in the outermost subroutine." doesn't grok because the only outer sub is the main program.
The anonymous sub is indeed inside a named sub, it is true, but there is no "outer" sub, unless the main program counts. I also do not see how the anonymous sub could be called when "the outermost sub is not active" since the only possible way to get there is via the named sub. I guess my ignorance is showing.
I tried changing the anonymous sub to a named sub, but that breaks the code in other ways. Fixes are possible, but the code then becomes a fair bit more complex, so IMHO this warning is simply bogus and should just be ignored.
So, is there a better fix, or is a permanent 'no warnings' in the anonymous sub the way to go?
Nat
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.