From 0dab6d38d596535a09af16a4feba57358ca67849 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Jul 2011 02:51:45 -0500 Subject: make this actually lexical --- lib/smartmatch.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/smartmatch.pm b/lib/smartmatch.pm index fd15e03..505b7c8 100644 --- a/lib/smartmatch.pm +++ b/lib/smartmatch.pm @@ -5,7 +5,6 @@ use warnings; use parent 'DynaLoader'; use B::Hooks::OP::Check; -use B::Hooks::EndOfScope; sub dl_load_flags { 0x01 } @@ -29,16 +28,11 @@ sub import { $cb = $engine->can('match') unless ref($cb); } - $^H ||= 0x020000; # HINT_LOCALIZE_HH - - $package->unimport; - $^H{'smartmatch_cb'} = smartmatch::register($cb); - on_scope_end { $package->unimport }; + smartmatch::register($cb); } sub unimport { - return unless exists $^H{'smartmatch_cb'}; - smartmatch::unregister(delete $^H{'smartmatch_cb'}); + smartmatch::unregister(); } 1; -- cgit v1.2.3