11 use vars qw(@ary %ary %hash);
42 ok defined($ary{'foo'});
43 ok !defined($ary{'bar'});
45 ok !defined($ary{'foo'});
49 no warnings 'deprecated';
57 no warnings 'deprecated';
65 no warnings 'deprecated';
79 like $@, qr/^Modification of a read/;
82 like $@, qr/^Modification of a read/;
86 tie my %foo, 'Tie::StdHash';
87 no warnings 'deprecated';
95 tie my @foo, 'Tie::StdArray';
96 no warnings 'deprecated';
103 # [perl #17753] segfault when undef'ing unquoted string constant
105 like $@, qr/^Can't modify constant item/;
109 # undefing a hash may free objects with destructors that then try to
110 # modify the hash. Ensure that the hash remains consistent
118 $hash{"k$_"} = bless ["k$_"], 'X';
119 $mirror{"k$_"} = "k$_";
129 note("----- DELETE($key) ------");
130 delete $mirror{$key};
132 is join('-', sort keys %hash), join('-', sort keys %mirror),
134 is join('-', sort map $_->[0], values %hash),
135 join('-', sort values %mirror), "$key: values";
137 # don't know exactly what we'll get from the iterator, but
138 # it must be a sensible value
139 my ($k, $v) = each %hash;
140 ok defined $k ? exists($mirror{$k}) : (keys(%mirror) == 0),
143 is delete $hash{$key}, undef, "$key: delete";
144 ($k, $v) = each %hash;
145 ok defined $k ? exists($mirror{$k}) : (keys(%mirror) <= 1),
149 if ($c <= $iters * 2) {
150 $hash{"k$c"} = bless ["k$c"], 'X';
151 $mirror{"k$c"} = "k$c";
156 each %hash; # set eiter
159 is scalar keys %hash, 0, "hash empty at end";
160 is $events, ('DE' x ($iters*2)), "events";
161 my ($k, $v) = each %hash;
162 is $k, undef, 'each undef at end';
165 # this will segfault if it fails
167 sub PVBM () { 'foo' }
168 { my $dummy = index 'foo', PVBM }