11 use vars qw(@ary %ary %hash);
42 ok defined($ary{'foo'});
43 ok !defined($ary{'bar'});
45 ok !defined($ary{'foo'});
48 no warnings 'deprecated';
55 no warnings 'deprecated';
60 no warnings 'deprecated';
66 no warnings 'deprecated';
71 no warnings 'deprecated';
85 like $@, qr/^Modification of a read/;
88 like $@, qr/^Modification of a read/;
92 tie my %foo, 'Tie::StdHash';
93 no warnings 'deprecated';
101 tie my @foo, 'Tie::StdArray';
102 no warnings 'deprecated';
109 # [perl #17753] segfault when undef'ing unquoted string constant
111 like $@, qr/^Can't modify constant item/;
115 # undefing a hash may free objects with destructors that then try to
116 # modify the hash. Ensure that the hash remains consistent
124 $hash{"k$_"} = bless ["k$_"], 'X';
125 $mirror{"k$_"} = "k$_";
135 note("----- DELETE($key) ------");
136 delete $mirror{$key};
138 is join('-', sort keys %hash), join('-', sort keys %mirror),
140 is join('-', sort map $_->[0], values %hash),
141 join('-', sort values %mirror), "$key: values";
143 # don't know exactly what we'll get from the iterator, but
144 # it must be a sensible value
145 my ($k, $v) = each %hash;
146 ok defined $k ? exists($mirror{$k}) : (keys(%mirror) == 0),
149 is delete $hash{$key}, undef, "$key: delete";
150 ($k, $v) = each %hash;
151 ok defined $k ? exists($mirror{$k}) : (keys(%mirror) <= 1),
155 if ($c <= $iters * 2) {
156 $hash{"k$c"} = bless ["k$c"], 'X';
157 $mirror{"k$c"} = "k$c";
162 each %hash; # set eiter
165 is scalar keys %hash, 0, "hash empty at end";
166 is $events, ('DE' x ($iters*2)), "events";
167 my ($k, $v) = each %hash;
168 is $k, undef, 'each undef at end';
171 # this will segfault if it fails
173 sub PVBM () { 'foo' }
174 { my $dummy = index 'foo', PVBM }