In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/6bc3ceb8e17fdabd5d840e82376879dbae92483b?hp=c2e082043e8d1890408e5866f6008cf0dac882e9>
- Log ----------------------------------------------------------------- commit 6bc3ceb8e17fdabd5d840e82376879dbae92483b Author: Yves Orton <[email protected]> Date: Tue Dec 6 22:29:03 2016 +0100 tweak perlmod.pod ----------------------------------------------------------------------- Summary of changes: pod/perlmod.pod | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pod/perlmod.pod b/pod/perlmod.pod index 888b54b071..2a101b6758 100644 --- a/pod/perlmod.pod +++ b/pod/perlmod.pod @@ -31,9 +31,15 @@ X<package> X<namespace> X<variable, global> X<global variable> X<global> Unlike Perl 4, in which all the variables were dynamic and shared one global name space, causing maintainability problems, Perl 5 provides two mechanisms for protecting code from having its variables stomped on by -other code: lexical variables created with C<my>, C<our> or C<state> and -the C<package> declaration which instructs the compiler as to which -namespace to prefix to unqualified dynamic names, which both protects +other code: lexically scoped variables created with C<my> or C<state> and +namespaced global variables, which are exposed via the C<vars> pragma, +or the C<our> keyword. Any global variable is considered to +be part of a namespace and can be accessed via a "fully qualified form", +and conversly any lexically scoped variable is considered to be part of +that lexical-scope, and does not have a "fully qualified form". +In perl namespaces are called "packages" and +the C<package> declaration instructs the compiler as to which +namespace to prefix to C<our> variables and unqualified dynamic names, which both protects against accidental stomping and provides an interface for deliberately clobbering global dynamic variables declared and used in other scopes or packages, when that is what you want to do. -- Perl5 Master Repository
