<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -297,13 +297,38 @@ sub import {
 
         $^H |= 0x020000;
 
-        # Our package guard gets invoked when we leave our lexical
-        # scope.
+        # Under Perl 5.10.x, the presenence of a string eval
+        # can cause %^H to be copied, which prevents destruction
+        # of our guard objects at the end of block.  This work-around
+        # was provided by Vincent Pit, who is a legend.
 
-        push(@ { $^H{$PACKAGE_GUARD} }, autodie::Scope::Guard-&gt;new(sub {
-            $class-&gt;_install_subs($pkg, \%unload_later);
-        }));
+        if (PERL510) {
 
+            BEGIN { require Variable::Magic; }
+
+            my $wiz = Variable::Magic::wizard(
+                data =&gt; sub { [$_[1]] },
+                free =&gt; sub { $_-&gt;() foreach @{ $_[1] }; () },
+            );
+
+            my $scope_guard = sub {
+                $class-&gt;_install_subs($pkg, \%unload_later);
+            };
+
+            if ( my $stack = Variable::Magic::getdata(%^H, $wiz) ) {
+                push( @{ $stack }, $scope_guard );
+            }
+            else {
+                Variable::Magic::cast( %^H, $wiz, $scope_guard );
+            }
+
+        }
+        else {
+            my $scope_guard = autodie::Scope::Guard-&gt;new(sub {
+                $class-&gt;_install_subs($pkg, \%unload_later);
+            });
+            push( @{ $^H{$PACKAGE_GUARD} }, $scope_guard );
+        }
     }
 
     return;</diff>
      <filename>lib/Fatal.pm</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aaf4bd7ce297d62b043f7254e6cfacabde1dde6e</id>
    </parent>
  </parents>
  <author>
    <name>Paul Fenwick</name>
    <email>pjf@perltraining.com.au</email>
  </author>
  <url>http://github.com/pfenwick/autodie/commit/ba2ce3c10d408b749a03b1ebb30c54522d1614e1</url>
  <id>ba2ce3c10d408b749a03b1ebb30c54522d1614e1</id>
  <committed-date>2009-07-05T05:35:30-07:00</committed-date>
  <authored-date>2009-07-05T05:35:30-07:00</authored-date>
  <message>Attempted Variable::Magic fix to the leaking near string-evals prolem</message>
  <tree>73050ad3b8fb45901eed9b509351e923b24b87f1</tree>
  <committer>
    <name>Paul Fenwick</name>
    <email>pjf@perltraining.com.au</email>
  </committer>
</commit>
