Commits

Shlomi Fish committed ed1fa7b

Fix tests with Hash::FieldHash installed.

See https://rt.cpan.org/Ticket/Display.html?id=77576 .

  • Participants
  • Parent commits 0c80fb5

Comments (0)

Files changed (2)

         - https://rt.cpan.org/Ticket/Display.html?id=77802
         - Thanks to duvny for the report, and to seldon, doy and Zefram
         for their assistance in fixing the warnings.
+    - Fix tests and run-time errors when Hash::FieldHash is installed
+    by no longer using Hash::FieldHash.
+        - https://rt.cpan.org/Ticket/Display.html?id=77576
+        - Thanks to hsk@fli-leibniz.de for reporting it, and to
+        Father Chrysostomos ( http://search.cpan.org/~sprout/ ) and
+        Mons Anderson for some diagnosis.
 
 1.99            Thu May 31 10:21:23 IDT 2012
     - Apply a patch from Mons Anderson ( mons@cpan.org ) for fixing the 
 }
 
 {
-    # Note that we could generate a new hashref each time this
-    # is called. However, that breaks "each %$element" and
-    # "keys %$element". So instead we consistently return the
-    # same reference to the same (tied) hash. To do that, we
-    # need to use a fieldhash. Hash::FieldHash requires at least
-    # Perl 5.8, but XML-LibXML already dropped support for older
-    # Perls since XML-LibXML-1.77.
-    #
-    # If Hash::FieldHash isn't available we can sort of do the
-    # same thing by relying upon the stringification of non-scalar
-    # hash keys, and performing a bit of cleanup in DESTROY.
-    #
     my %tiecache;
-    BEGIN
+
+    sub __destroy_tiecache
     {
-        if (eval { require Hash::FieldHash; 1 })
-        {
-            Hash::FieldHash::fieldhashes(\%tiecache);
-            *__destroy_tiecache = sub {};
-        }
-        else
-        {
-            *__destroy_tiecache = sub { delete $tiecache{ 0+$_[0] } };
-        }
-    };
+        delete $tiecache{ 0+$_[0] };
+    }
+
     sub getAttributeHash
     {
         my $self = shift;