in reply to About packages and scopes
A lexical variable is a variable that is accessible only within its inner-most enclosing scope. It's declared using my and cannot be accessed outside that scope. Period. Now, a variable declared with my at a file level is considered to be withing the implicit scope of the package. Still unaccessible outside that scope. (Closures are an indirect access to a lexical variable, so aren't really part of this discussion.)
Variables that are either not declared at all or declared with our or local are inserted into the symbol table of that namespace. If declared, they're considered to be block-scoped globals. The primary difference, simply put, between our and local is that our is 5.6+, but works under strict vars. local does not. (There's more to it than that, but look around the Monastery and you'll find more on it than you'll ever want to know.)
What does all this have to do with packages? Well, if you want to access a variable declared in package Foo from package Bar, you have to make sure you either are not using strict vars (Bad idea!!!) or have declared your variables with our. At this point, you can do a number of things.
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|