Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Perl Programming/Keywords/package

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Perl pack pipe Keywords The package keyword The package keyword declares the BLOCK or the rest of the compilation unit within the given namespace. The package scope is given by either the supplied BLOCK or from the declaration through the end of the current scope, which may be the enclosing block, eval, or file. In other words, without BLOCK, the scopes are just like with my, our, and state operators. Only overridden or special identifiers such as ARGV, ENV, and STDOUT that qualify into main:: are exempted. Only dynamic variables are affected by the package keyword. Lexically-scoped created with my, our, and state are exempted. It is allowed to switch into a package at more than one place, as this only determines which default symbol table the compiler uses for the rest of that block. An identifier prefixed by it's package name can access another package, like $SomePack::var or ThatPack::INPUT_HANDLE. Without the package name, the main package is assumed: $::sail is understood as $main::sail. With VERSION, the package sets the $VERSION variable in the given namespace to a version object with the provided VERSION. VERSION must be a strict-style version number with at least three components, as defined by the version module, $VERSION should be set only once in a package. Syntax package NAMESPACE package NAMESPACE VERSION package NAMESPACE BLOCK package NAMESPACE VERSION BLOCK See also my our pop shift state Perl pack pipe Keywords