Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Declare and assign a package v ...Load in a module at compile time (Berikutnya)
Keywords altering or affecting scoping of identifiers

Declare a separate global namespace

Daftar Isi

  • package NAMESPACE
  • package NAMESPACE VERSION

  • package NAMESPACE BLOCK
  • package NAMESPACE VERSION BLOCK

    Declares the BLOCK or the rest of the compilation unit as being in thegiven namespace. The scope of the package declaration is either thesupplied code BLOCK or, in the absence of a BLOCK, from the declarationitself through the end of current scope (the enclosing block, file, oreval). That is, the forms without a BLOCK are operative through the endof the current scope, just like the my, state, and our operators.All unqualified dynamic identifiers in this scope will be in the givennamespace, except where overridden by another package declaration orwhen they're one of the special identifiers that qualify into main::,like STDOUT, ARGV, ENV, and the punctuation variables.

    A package statement affects dynamic variables only, including thoseyou've used local on, but not lexical variables, which are createdwith my, state, or our. Typically it would be the first declaration in a file included by require or use. You can switch into apackage in more than one place, since this only determines which default symbol table the compiler uses for the rest of that block. You can refer toidentifiers in other packages than the current one by prefixing the identifierwith the package name and a double colon, as in $SomePack::varor ThatPack::INPUT_HANDLE. If package name is omitted, the mainpackage as assumed. That is, $::sail is equivalent to$main::sail (as well as to $main'sail, still seen in ancientcode, mostly from Perl 4).

    If VERSION is provided, package sets the $VERSION variable in the givennamespace to a version object with the VERSION provided. VERSION must be a"strict" style version number as defined by the version module: a positivedecimal number (integer or decimal-fraction) without exponentiation or else adotted-decimal v-string with a leading 'v' character and at least threecomponents. You should set $VERSION only once per package.

    See Packages in perlmod for more information about packages, modules,and classes. See perlsub for other scoping issues.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Declare and assign a package v ...Load in a module at compile time (Berikutnya)