1 package # hide from the pauses
2 namespace::clean::_PP_OSE;
7 use namespace::clean::_PP_SG;
9 use Hash::Util::FieldHash 'fieldhash';
11 # Hash::Util::FieldHash is not deleting elements in void context. When
12 # you call delete() in non-void context, a mortal scalar is returned. A
13 # mortal scalar is one whose reference count decreases at the end of the
14 # current statement. During scope exit, ‘statement’ is not clearly
15 # defined, so more scope unwinding could happen before the mortal gets
17 # By tying it and overriding DELETE, we can force the deletion into
23 package namespace::clean::_TieHintHashFieldHash;
24 use base 'Tie::StdHash';
26 shift->SUPER::DELETE(@_);
27 1; # put the preceding statement in void context
32 sub on_scope_end (&) {
35 tie(%hh, 'namespace::clean::_TieHintHashFieldHash')
38 push @{$hh{\%^H} ||= []},
39 namespace::clean::_PP_SG->arm(shift);