From: Florian Ragwitz Date: Sun, 19 Oct 2008 07:53:54 +0000 (+0000) Subject: Use B::Hooks::EndOfScope instead of %^H and Scope::Guard. X-Git-Tag: 0.005000~53^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b9a35c84131e13830d041a7af60b245d272abda4;p=p5sagit%2FDevel-Declare.git Use B::Hooks::EndOfScope instead of %^H and Scope::Guard. --- diff --git a/Makefile.PL b/Makefile.PL index 0aa54c8..b41dbd1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -7,7 +7,7 @@ all_from 'lib/Devel/Declare.pm'; requires 'Scalar::Util'; build_requires 'Test::More'; -build_requires 'Scope::Guard'; +build_requires 'B::Hooks::EndOfScope'; postamble(<<'EOM'); $(OBJECT) : stolen_chunk_of_toke.c diff --git a/lib/Devel/Declare.pm b/lib/Devel/Declare.pm index 61c54a3..a315f66 100644 --- a/lib/Devel/Declare.pm +++ b/lib/Devel/Declare.pm @@ -290,13 +290,13 @@ Devel::Declare - =head1 SYNOPSIS use Devel::Declare (); - use Scope::Guard; { package MethodHandlers; use strict; use warnings; + use B::Hooks::EndOfScope; our ($Declarator, $Offset); @@ -391,13 +391,12 @@ Devel::Declare - } 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); - }); + }; } } diff --git a/t/method-no-semi.t b/t/method-no-semi.t index 731584f..86eda8e 100644 --- a/t/method-no-semi.t +++ b/t/method-no-semi.t @@ -1,11 +1,11 @@ use Devel::Declare (); -use Scope::Guard; { package MethodHandlers; use strict; use warnings; + use B::Hooks::EndOfScope; our ($Declarator, $Offset); @@ -100,13 +100,12 @@ use Scope::Guard; } 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); - }); + }; } } diff --git a/t/statement.t b/t/statement.t index bccc35f..9116dbb 100644 --- a/t/statement.t +++ b/t/statement.t @@ -1,12 +1,12 @@ use Devel::Declare (); use Test::More qw(no_plan); -use Scope::Guard; { package FoomHandlers; use strict; use warnings; + use B::Hooks::EndOfScope; our ($Declarator, $Offset); @@ -80,13 +80,12 @@ use Scope::Guard; } sub inject_scope { - $^H |= 0x120000; - $^H{DD_FOOMHANDLERS} = 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); - }); + }; } package Foo;