# By doing this, we save 1 run time check for *every* call to import.
my $const = $] > 5.009002;
my $downgrade = $] < 5.015004; # && $] >= 5.008
- my $constarray = $] > 5.019001;
+ my $constarray = $] >= 5.019003;
if ($const) {
Internals::SvREADONLY($const, 1);
Internals::SvREADONLY($downgrade, 1);
=head1 CAVEATS
-List constants were not inlined unless you are using Perl v5.20 or higher.
+List constants are not inlined unless you are using Perl v5.20 or higher.
It is not possible to have a subroutine or a keyword with the same
name as a constant in the same package. This is probably a Good Thing.
eval { for (immutable) { ${\$_} = 432 } };
SKIP: {
require Config;
- local $TODO;
if ($Config::Config{useithreads}) {
- skip "fails under threads", 1 if $] < 5.019001;
+ skip "fails under threads", 1 if $] < 5.019003;
}
like $@, qr/^Modification of a read-only value attempted at /,
'... and immutable through refgen, too';
'constant created in existing stash slot is immutable';
eval { for (existing_stash_entry) { ${\$_} = 432 } };
SKIP: {
- local $TODO;
if ($Config::Config{useithreads}) {
- skip "fails under threads", 1 if $] < 5.019001;
+ skip "fails under threads", 1 if $] < 5.019003;
}
like $@, qr/^Modification of a read-only value attempted at /,
'... and immutable through refgen, too';
}
# Test that list constants are also immutable. This only works under
-# 5.19.2 and later (er, except it doesn’t work under that version yet,
-# either, hence the to-do status).
+# 5.19.3 and later.
SKIP: {
- skip "fails under 5.19.1 and earlier", 2 if $] < 5.019002;
+ skip "fails under 5.19.2 and earlier", 2 if $] < 5.019003;
use constant constant_list => 1..2;
for (constant_list) {
my $num = $_;
my ($expect, $expect_nt) =
- $] >= 5.019002
+ $] >= 5.019003
? (" is a constant sub, optimized to a AV\n") x 2
: (<<'EOT_EOT', <<'EONT_EONT');
# 3 <1> leavesub[2 refs] K/REFC,1 ->(end)
# n <$> const[PV "b-cmp-a"] s ->o
# p <;> nextstate(main 916 optree_constants.t:313) v:>,<,%,{ ->q
# q <$> const[PVNV 0] s/SHORT ->r < 5.017002
-# q <$> const[PVNV 0] s/FOLD,SHORT ->r >=5.017002 < 5.019001
-# q <$> const[SPECIAL sv_no] s/FOLD,SHORT ->r >=5.019001
+# q <$> const[PVNV 0] s/FOLD,SHORT ->r >=5.017002 < 5.019003
+# q <$> const[SPECIAL sv_no] s/FOLD,SHORT ->r >=5.019003
EOT_EOT
# r <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->r
$c + $d,
'SV = ([NI])V\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\(PADTMP,\1OK,p\1OK\\) # $] < 5.019002
- FLAGS = \\(\1OK,p\1OK\\) # $] >=5.019002
+ FLAGS = \\(PADTMP,\1OK,p\1OK\\) # $] < 5.019003
+ FLAGS = \\(\1OK,p\1OK\\) # $] >=5.019003
\1V = 456');
($d = "789") += 0.1;
chr(256).chr(0).chr(512),
'SV = PV\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019002
- FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019002
+ FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019003
+ FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019003
PV = $ADDR "\\\214\\\101\\\0\\\235\\\101"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
CUR = 5
LEN = \\d+');
chr(256).chr(0).chr(512),
'SV = PV\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019002
- FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019002
+ FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019003
+ FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019003
PV = $ADDR "\\\304\\\200\\\0\\\310\\\200"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
CUR = 5
LEN = \\d+');