From: Lukas Mai Date: Mon, 18 Jun 2012 06:59:13 +0000 (+0200) Subject: do magic ourselves, not depend on B::Hooks::EndOfScope X-Git-Tag: v0.05_03~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9516672ceeb9882e00bd54b5bc60622c838a2a4;p=p5sagit%2FFunction-Parameters.git do magic ourselves, not depend on B::Hooks::EndOfScope --- diff --git a/Makefile.PL b/Makefile.PL index a96a82f..b3023ab 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -18,7 +18,6 @@ WriteMakefile( }, PREREQ_PM => { 'Carp' => 0, - 'B::Hooks::EndOfScope' => 0, 'XSLoader' => 0, 'bytes' => 0, 'warnings' => 0, diff --git a/Parameters.xs b/Parameters.xs index 29baa13..3e4faf1 100644 --- a/Parameters.xs +++ b/Parameters.xs @@ -327,6 +327,26 @@ static int my_keyword_plugin(pTHX_ char *keyword_ptr, STRLEN keyword_len, OP **o return ret; } +static int magic_free(pTHX_ SV *sv, MAGIC *mg) { + lex_stuff_pvn("}", 1, 0); + return 0; +} + +static int magic_nop(pTHX_ SV *sv, MAGIC *mg) { + return 0; +} + +static MGVTBL my_vtbl = { + 0, /* get */ + 0, /* set */ + 0, /* len */ + 0, /* clear */ + magic_free, /* free */ + 0, /* copy */ + 0, /* dup */ + magic_nop /* local */ +}; + WARNINGS_RESET MODULE = Function::Parameters PACKAGE = Function::Parameters @@ -347,6 +367,6 @@ WARNINGS_ENABLE { } WARNINGS_RESET void -xs_fini() +_fini() CODE: - lex_stuff_pvn("}", 1, 0); + sv_magicext((SV *)GvHV(PL_hintgv), NULL, PERL_MAGIC_ext, &my_vtbl, NULL, 0); diff --git a/lib/Function/Parameters.pm b/lib/Function/Parameters.pm index 97dd88e..de10a42 100644 --- a/lib/Function/Parameters.pm +++ b/lib/Function/Parameters.pm @@ -11,7 +11,6 @@ BEGIN { XSLoader::load; } -use B::Hooks::EndOfScope qw(on_scope_end); use Carp qw(confess); use bytes (); @@ -91,12 +90,6 @@ sub unimport { } } -sub _fini { - on_scope_end { - xs_fini; - }; -} - 'ok'