r29321 - in /branches/upstream/libb-hooks-endofscope-perl/current: Changes MANIFEST META.yml Makefile.PL README inc/Module/Install/ExtraTests.pm lib/B/Hooks/EndOfScope.pm t/eval.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Mon Jan 5 14:30:38 UTC 2009


Author: gregoa
Date: Mon Jan  5 14:30:35 2009
New Revision: 29321

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29321
Log:
[svn-upgrade] Integrating new upstream version, libb-hooks-endofscope-perl (0.05)

Added:
    branches/upstream/libb-hooks-endofscope-perl/current/t/eval.t
Modified:
    branches/upstream/libb-hooks-endofscope-perl/current/Changes
    branches/upstream/libb-hooks-endofscope-perl/current/MANIFEST
    branches/upstream/libb-hooks-endofscope-perl/current/META.yml
    branches/upstream/libb-hooks-endofscope-perl/current/Makefile.PL
    branches/upstream/libb-hooks-endofscope-perl/current/README
    branches/upstream/libb-hooks-endofscope-perl/current/inc/Module/Install/ExtraTests.pm
    branches/upstream/libb-hooks-endofscope-perl/current/lib/B/Hooks/EndOfScope.pm

Modified: branches/upstream/libb-hooks-endofscope-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/Changes?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/Changes (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/Changes Mon Jan  5 14:30:35 2009
@@ -1,3 +1,9 @@
+0.05  Sun, 04 Jan 2009 20:46:07 +0100
+  * Use Variable::Magic and cast %^H instead Scope::Guard and relying
+    on a timely destruction of objects within %^H. This fixes using
+    on_scope_end in blocks where string evals are compiled as those
+    increment the refcount of objects in %^H on 5.10.
+
 0.04  Mon, 20 Oct 2008 12:56:23 +0200
   * Remove an unused bit from the $^H mask.
 

Modified: branches/upstream/libb-hooks-endofscope-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/MANIFEST?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/MANIFEST (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/MANIFEST Mon Jan  5 14:30:35 2009
@@ -15,5 +15,6 @@
 META.yml
 README
 t/basic.t
+t/eval.t
 xt/author/pod.t
 xt/author/podcoverage.t

Modified: branches/upstream/libb-hooks-endofscope-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/META.yml?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/META.yml (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/META.yml Mon Jan  5 14:30:35 2009
@@ -16,9 +16,9 @@
     - inc
     - t
 requires:
-  Scope::Guard: 0
   Sub::Exporter: 0
+  Variable::Magic: 0
   perl: 5.8.0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.04
+version: 0.05

Modified: branches/upstream/libb-hooks-endofscope-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/Makefile.PL?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/Makefile.PL (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/Makefile.PL Mon Jan  5 14:30:35 2009
@@ -5,7 +5,7 @@
 name 'B-Hooks-EndOfScope';
 all_from 'lib/B/Hooks/EndOfScope.pm';
 
-requires 'Scope::Guard';
+requires 'Variable::Magic';
 requires 'Sub::Exporter';
 test_requires 'Test::More';
 

Modified: branches/upstream/libb-hooks-endofscope-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/README?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/README (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/README Mon Jan  5 14:30:35 2009
@@ -22,7 +22,7 @@
 SEE ALSO
     Sub::Exporter
 
-    Scope::Guard
+    Variable::Magic
 
 AUTHOR
     Florian Ragwitz <rafl at debian.org>

Modified: branches/upstream/libb-hooks-endofscope-perl/current/inc/Module/Install/ExtraTests.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/inc/Module/Install/ExtraTests.pm?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/inc/Module/Install/ExtraTests.pm (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/inc/Module/Install/ExtraTests.pm Mon Jan  5 14:30:35 2009
@@ -6,7 +6,7 @@
 use Module::Install::Base;
 
 BEGIN {
-  our $VERSION = '0.003';
+  our $VERSION = '0.006';
   our $ISCORE  = 1;
   our @ISA     = qw{Module::Install::Base};
 }
@@ -14,7 +14,7 @@
 sub extra_tests {
   my ($self) = @_;
 
-  die "extra_tests requested, but no ./xt exists\n" unless -d 'xt';
+  return unless -d 'xt';
   return unless my @content = grep { $_ =~ /^[.]/ } <xt/*>;
 
   die "unknown files found in ./xt" if grep { -f } @content;
@@ -66,7 +66,7 @@
   # out on the command line can blow over its exec limit.
   require ExtUtils::Command;
   push @ARGV, __PACKAGE__->_deep_t($author_tests)
-    if $author_tests and $is_author;
+    if $author_tests and (exists $ENV{AUTHOR_TESTING} ? $ENV{AUTHOR_TESTING} : $is_author);
 
   push @ARGV, __PACKAGE__->_deep_t($release_tests)
     if $release_tests and $ENV{RELEASE_TESTING};

Modified: branches/upstream/libb-hooks-endofscope-perl/current/lib/B/Hooks/EndOfScope.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/lib/B/Hooks/EndOfScope.pm?rev=29321&op=diff
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/lib/B/Hooks/EndOfScope.pm (original)
+++ branches/upstream/libb-hooks-endofscope-perl/current/lib/B/Hooks/EndOfScope.pm Mon Jan  5 14:30:35 2009
@@ -4,11 +4,9 @@
 package B::Hooks::EndOfScope;
 
 use 5.008000;
-use Scope::Guard;
+use Variable::Magic;
 
-our $VERSION = '0.04';
-
-our $SCOPE_HOOK_KEY = 'SCOPE_END_HOOK';
+our $VERSION = '0.05';
 
 use Sub::Exporter -setup => {
     exports => ['on_scope_end'],
@@ -43,18 +41,30 @@
 
 =cut
 
-sub on_scope_end (&) {
-    my $cb = shift;
+{
+    my $wiz = Variable::Magic::wizard
+        data => sub { [$_[1]] },
+        free => sub { $_->() for @{ $_[1] }; () };
 
-    $^H |= 0x020000;
-    $^H{ $SCOPE_HOOK_KEY } = [Scope::Guard->new($cb), @{ $^H{ $SCOPE_HOOK_KEY } || [] }];
+    sub on_scope_end (&) {
+        my $cb = shift;
+
+        $^H |= 0x020000;
+
+        if (my $stack = Variable::Magic::getdata %^H, $wiz) {
+            push @{ $stack }, $cb;
+        }
+        else {
+            Variable::Magic::cast %^H, $wiz, $cb;
+        }
+    }
 }
 
 =head1 SEE ALSO
 
 L<Sub::Exporter>
 
-L<Scope::Guard>
+L<Variable::Magic>
 
 =head1 AUTHOR
 

Added: branches/upstream/libb-hooks-endofscope-perl/current/t/eval.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libb-hooks-endofscope-perl/current/t/eval.t?rev=29321&op=file
==============================================================================
--- branches/upstream/libb-hooks-endofscope-perl/current/t/eval.t (added)
+++ branches/upstream/libb-hooks-endofscope-perl/current/t/eval.t Mon Jan  5 14:30:35 2009
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+use B::Hooks::EndOfScope;
+
+our $called;
+
+sub foo {
+    BEGIN { on_scope_end { $called = 1 } }
+
+    # uncomment this to make the test pass
+    eval '42';
+}
+
+BEGIN {
+    ok($called, 'callback invoked');
+}




More information about the Pkg-perl-cvs-commits mailing list