[Bast-commits] r5885 - Devel-Declare/1.000/trunk/lib/Devel

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Mon Apr 13 17:08:45 GMT 2009


Author: rafl
Date: 2009-04-13 18:08:45 +0100 (Mon, 13 Apr 2009)
New Revision: 5885

Modified:
   Devel-Declare/1.000/trunk/lib/Devel/Declare.pm
Log:
Port the docs from Scope::Guard + %^H to B::Hooks::EndOfScope.

Modified: Devel-Declare/1.000/trunk/lib/Devel/Declare.pm
===================================================================
--- Devel-Declare/1.000/trunk/lib/Devel/Declare.pm	2009-04-13 12:47:47 UTC (rev 5884)
+++ Devel-Declare/1.000/trunk/lib/Devel/Declare.pm	2009-04-13 17:08:45 UTC (rev 5885)
@@ -580,10 +580,9 @@
 where 'method' is a subroutine that takes a code block.  Spot the problem?
 The first one doesn't have a semicolon at the end of it!  Unlike 'sub' which
 is a builtin, this is just a normal statement, so we need to terminate it.
-Luckily, using the bastard spawn of L<Scope::Guard> and some hints hash
-hackery, we can do this!
+Luckily, using C<B::Hooks::EndOfScope>, we can do this!
 
-  use Scope::Guard;
+  use B::Hooks::EndOfScope;
 
 We'll add this to what gets 'injected' at the beginning of the method source.
 
@@ -596,13 +595,12 @@
 is compiled.
 
   sub inject_scope {
-    $^H |= 0x120000;
-    $^H{DD_METHODHANDLERS} = Scope::Guard->new(sub {
+    on_scope_end {
       my $linestr = Devel::Declare::get_linestr;
       my $offset = Devel::Declare::get_linestr_offset;
       substr($linestr, $offset, 0) = ';';
       Devel::Declare::set_linestr($linestr);
-    });
+    };
   }
 
 =head2 Shadowing each method.




More information about the Bast-commits mailing list