This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / dist / constant / lib / constant.pm
index 64a20ba..e4b8fd2 100644 (file)
@@ -3,8 +3,8 @@ use 5.008;
 use strict;
 use warnings::register;
 
-use vars qw($VERSION %declared);
-$VERSION = '1.32';
+our $VERSION = '1.33';
+our %declared;
 
 #=======================================================================
 
@@ -277,6 +277,13 @@ as C<< Some::Package->CONSTANT >> or as C<< $obj->CONSTANT >> where
 C<$obj> is an instance of C<Some::Package>.  Subclasses may define
 their own constants to override those in their base class.
 
+As of version 1.32 of this module, constants can be defined in packages
+other than the caller, by including the package name in the name of the
+constant:
+
+    use constant "OtherPackage::FWIBBLE" => 7865;
+    constant->import("Other::FWOBBLE",$value); # dynamically at run time
+
 The use of all caps for constant names is merely a convention,
 although it is recommended in order to make constants stand out
 and to help avoid collisions with other barewords, keywords, and