summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/constant.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/constant.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/constant.pm30
1 files changed, 8 insertions, 22 deletions
diff --git a/Master/tlpkg/tlperl/lib/constant.pm b/Master/tlpkg/tlperl/lib/constant.pm
index ef618c43ab2..035bce23742 100644
--- a/Master/tlpkg/tlperl/lib/constant.pm
+++ b/Master/tlpkg/tlperl/lib/constant.pm
@@ -1,10 +1,10 @@
package constant;
-use 5.005;
+use 5.008;
use strict;
use warnings::register;
use vars qw($VERSION %declared);
-$VERSION = '1.23';
+$VERSION = '1.27';
#=======================================================================
@@ -17,10 +17,9 @@ my %forced_into_main = map +($_, 1),
my %forbidden = (%keywords, %forced_into_main);
-my $str_end = $] >= 5.006 ? "\\z" : "\\Z";
-my $normal_constant_name = qr/^_?[^\W_0-9]\w*$str_end/;
-my $tolerable = qr/^[A-Za-z_]\w*$str_end/;
-my $boolean = qr/^[01]?$str_end/;
+my $normal_constant_name = qr/^_?[^\W_0-9]\w*\z/;
+my $tolerable = qr/^[A-Za-z_]\w*\z/;
+my $boolean = qr/^[01]?\z/;
BEGIN {
# We'd like to do use constant _CAN_PCS => $] > 5.009002
@@ -30,18 +29,8 @@ BEGIN {
my $const = $] > 5.009002;
*_CAN_PCS = sub () {$const};
- # Before this makes its way into a dev perl release, we have to do
- # browser-sniffing, as it were....
- return unless $const;
- *{chr 256} = \3;
- if (exists ${__PACKAGE__."::"}{"\xc4\x80"}) {
- delete ${__PACKAGE__."::"}{"\xc4\x80"};
- *_DOWNGRADE = sub () {1};
- }
- else {
- delete ${__PACKAGE__."::"}{chr 256};
- *_DOWNGRADE = sub () {0};
- }
+ my $downgrade = $] < 5.015004; # && $] >= 5.008
+ *_DOWNGRADE = sub () { $downgrade };
}
#=======================================================================
@@ -130,7 +119,7 @@ sub import {
if ($multiple || @_ == 1) {
my $scalar = $multiple ? $constants->{$name} : $_[0];
- if (_DOWNGRADE) { # for 5.10 to 5.14
+ if (_DOWNGRADE) { # for 5.8 to 5.14
# Work around perl bug #31991: Sub names (actually glob
# names in general) ignore the UTF8 flag. So we have to
# turn it off to get the "right" symbol table entry.
@@ -373,9 +362,6 @@ C<< CONSTANT => 'value' >>.
L<Readonly> - Facility for creating read-only scalars, arrays, hashes.
-L<Const> - Facility for creating read-only variables. Similar to C<Readonly>,
-but uses C<SvREADONLY> instead of C<tie>.
-
L<Attribute::Constant> - Make read-only variables via attribute
L<Scalar::Readonly> - Perl extension to the C<SvREADONLY> scalar flag