package
package namespace
- Declares that the rest of the innermost enclosing block, subroutine,
evalor file belongs to the indicated namespace. (The scope of apackagedeclaration is thus the same as the scope of alocalormydeclaration.) All subsequent references to unqualified global identifiers will be resolved by looking them up in the declared packages symbol table. Apackagedeclaration affects only global variables - including those you've usedlocalon - but not lexical variables created withmy.Typically you would put a
packagedeclaration as the first thing in a file that is to be included by therequireoruseoperator, but you can put one anywhere that a statement would be legal. When defining a class or a module file, it is customary to name the package the same name as the file, to avoid confusion. (It's also customary to name such packages beginning with a capital letter, because lowercase modules are, by convention, interpreted as pragmas.)