# I ought to keep this test easily backwards compatible to 5.004, so no
# qr//;
-BEGIN {
- if ($] < 5.005) {
- print "1..0 # Skip: usage of qr//\n";
- exit 0;
- }
-}
-
# This test checks downgrade behaviour on pre-5.8 perls when new 5.8 features
# are encountered.
plan tests => 67;
}
-$UTF8_CROAK = qr/^Cannot retrieve UTF8 data in non-UTF8 perl/;
-$RESTRICTED_CROAK = qr/^Cannot retrieve restricted hash/;
+$UTF8_CROAK = "/^Cannot retrieve UTF8 data in non-UTF8 perl/";
+$RESTRICTED_CROAK = "/^Cannot retrieve restricted hash/";
my %tests;
{
my @keys = keys %$hash;
my ($key, $value) = each %$hash;
eval {$hash->{$key} = reverse $value};
- like( $@, qr/^Modification of a read-only value attempted/,
+ like( $@, "/^Modification of a read-only value attempted/",
'trying to change a locked key' );
is ($hash->{$key}, $value, "hash should not change?");
eval {$hash->{use} = 'perl'};
- like( $@, qr/^Attempt to access disallowed key 'use' in a restricted hash/,
+ like( $@, "/^Attempt to access disallowed key 'use' in a restricted hash/",
'trying to add another key' );
ok (eq_array([keys %$hash], \@keys), "Still the same keys?");
}
'trying to change a restricted key' );
is ($hash->{$key}, reverse ($value), "hash should change");
eval {$hash->{use} = 'perl'};
- like( $@, qr/^Attempt to access disallowed key 'use' in a restricted hash/,
+ like( $@, "/^Attempt to access disallowed key 'use' in a restricted hash/",
'trying to add another key' );
ok (eq_array([keys %$hash], \@keys), "Still the same keys?");
}
if ($] > 5.007002) {
print "# We have utf8 hashes, so test that the utf8 hashes in <DATA> are valid\n";
my $hash = thaw_hash ('Hash with utf8 keys', \%U_HASH);
+ my $a_circumflex = (ord ('A') == 193 ? "\x47" : "\xe5");
for (keys %$hash) {
my $l = 0 + /^\w+$/;
my $r = 0 + $hash->{$_} =~ /^\w+$/;
cmp_ok ($l, '==', $r, sprintf "key length %d", length $_);
- cmp_ok ($l, '==', $_ eq "ch\xe5teau" ? 0 : 1);
+ cmp_ok ($l, '==', $_ eq "ch${a_circumflex}teau" ? 0 : 1);
}
if (eval "use Hash::Util; 1") {
print "# We have Hash::Util, so test that the restricted utf8 hash is valid\n";
my $l = 0 + /^\w+$/;
my $r = 0 + $hash->{$_} =~ /^\w+$/;
cmp_ok ($l, '==', $r, sprintf "key length %d", length $_);
- cmp_ok ($l, '==', $_ eq "ch\xe5teau" ? 0 : 1);
+ cmp_ok ($l, '==', $_ eq "ch${a_circumflex}teau" ? 0 : 1);
}
test_locked_hash ($hash);
} else {
end
begin 301 Locked hash placeholder
-C!049`0````(.%`````69I).%H@H%F:23A:(`````!)>%F9,`
+C!049`0````(.%`````69I).%H@H%F:23A:($````!)>%F9,`
end