Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Actually, I disagree. The provided code is actually visually very helpful, as it leads (mind you, leads, not misleads) the reader to think that bar() makes sense in the context of foo().
From OOP we know that Perl doesn't protect methods and variables. Perl would much rather that you didn't come into its home uninvited than put locks on its doors. The reader of the code should simply not call bar() from outside foo(). That said, the suggestion to convert bar() into an anonymous sub is a good one. That makes things even clearer.
--
when small people start casting long shadows, it is time to go to bed In reply to Re^2: a sub within a sub -- revisiting
by punkish
|
|