in reply to Re^3: Threads and Shared Variables
in thread Threads and Shared Variables

If it's just a quirk then I can accept that, I was just trying to establish whether or not I missed something in the documentation (I can't find anything about not nesting subroutines). My reasoning behind doing this was not to pollute the package namespace. I am used to being able to do this in other languages (javascript).

Thanks for the advice,
Hermes

Replies are listed 'Best First'.
Re^5: Threads and Shared Variables
by BrowserUk (Patriarch) on Jul 04, 2013 at 22:35 UTC
    (I can't find anything about not nesting subroutines)

    See http://perldoc.perl.org/perlref.html#Function-Templates and read the three paragraphs where the first starts "Access to lexicals that change over time...".


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^5: Threads and Shared Variables
by Arunbear (Prior) on Jul 05, 2013 at 11:25 UTC
    Apart from the experimental lexical subs introduced with 5.18, any named function created with sub (even those that are nested in an inner scope) become part of a package's namespace, so you can't avoid namesapce pollution in this way.