r47379 - in /branches/upstream/libsub-uplevel-perl/current: Build.PL Changes MANIFEST MANIFEST.SKIP META.yml Makefile.PL README lib/Sub/Uplevel.pm lib/Sub/Uplevel.pod t/08_exporter.t t/lib/Bar.pm t/lib/Importer.pm
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Tue Nov 17 19:38:06 UTC 2009
Author: jawnsy-guest
Date: Tue Nov 17 19:37:59 2009
New Revision: 47379
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47379
Log:
[svn-upgrade] Integrating new upstream version, libsub-uplevel-perl (0.2200)
Added:
branches/upstream/libsub-uplevel-perl/current/t/08_exporter.t
branches/upstream/libsub-uplevel-perl/current/t/lib/Bar.pm
branches/upstream/libsub-uplevel-perl/current/t/lib/Importer.pm
Modified:
branches/upstream/libsub-uplevel-perl/current/Build.PL
branches/upstream/libsub-uplevel-perl/current/Changes
branches/upstream/libsub-uplevel-perl/current/MANIFEST
branches/upstream/libsub-uplevel-perl/current/MANIFEST.SKIP
branches/upstream/libsub-uplevel-perl/current/META.yml
branches/upstream/libsub-uplevel-perl/current/Makefile.PL
branches/upstream/libsub-uplevel-perl/current/README
branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pm
branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pod
Modified: branches/upstream/libsub-uplevel-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/Build.PL?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/Build.PL (original)
+++ branches/upstream/libsub-uplevel-perl/current/Build.PL Tue Nov 17 19:37:59 2009
@@ -1,31 +1,36 @@
-use 5.006;
-use strict;
-use lib 'inc';
-eval "require Pod::WikiDoc";
-my $class = $@ ? "Module::Build" : "Module::Build::WikiDoc";
-eval "require $class";
-
-$class->new(
- module_name => 'Sub::Uplevel',
- dist_author => 'David A. Golden <dagolden at cpan.org>',
- license => 'perl',
- create_readme => 1,
- create_makefile_pl => 'traditional',
- requires => {
- 'perl' => 5.006,
- },
- build_requires => {
- 'Carp' => 0,
- 'Test::More' => 0.47,
- },
- meta_add => {
- no_index => {
- package => [ 'DB' ],
- directory => [ qw{
- examples
- inc
- }],
- }
- },
-)->create_build_script;
-
+use 5.006;
+use strict;
+use lib 'inc';
+eval "require Pod::WikiDoc";
+my $class = $@ ? "Module::Build" : "Module::Build::WikiDoc";
+eval "require $class";
+
+$class->new(
+ module_name => 'Sub::Uplevel',
+ dist_author => 'David A. Golden <dagolden at cpan.org>',
+ license => 'perl',
+ create_readme => 1,
+ create_makefile_pl => 'traditional',
+ requires => {
+ 'perl' => 5.006,
+ },
+ build_requires => {
+ 'Carp' => 0,
+ 'Test::More' => 0.47,
+ },
+ meta_add => {
+ no_index => {
+ package => [ 'DB' ],
+ directory => [ qw{
+ examples
+ inc
+ }],
+ },
+ },
+ meta_merge => {
+ resources => {
+ repository => 'http://github.com/dagolden/sub-uplevel',
+ },
+ },
+)->create_build_script;
+
Modified: branches/upstream/libsub-uplevel-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/Changes?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/Changes (original)
+++ branches/upstream/libsub-uplevel-perl/current/Changes Tue Nov 17 19:37:59 2009
@@ -1,4 +1,14 @@
Changes for Sub::Uplevel
+
+0.22 Tue Nov 17 05:38:42 EST 2009
+
+ - meta: added repository to metadata [Alexandr Ciornii]
+
+0.21_01 Sat Nov 29 15:24:49 EST 2008
+
+ - added: the ":aggressive" tag may be used to force reloading of
+ Exporter, which often binds caller() prior to Sub::Uplevel's global
+ override
0.2002 Thu Sep 11 14:33:09 EDT 2008
Modified: branches/upstream/libsub-uplevel-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/MANIFEST?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/MANIFEST (original)
+++ branches/upstream/libsub-uplevel-perl/current/MANIFEST Tue Nov 17 19:37:59 2009
@@ -18,7 +18,10 @@
t/05_honor_prior_override.t
t/06_db_args.t
t/07_uplevel_too_high.t
+t/08_exporter.t
+t/lib/Bar.pm
t/lib/Foo.pm
+t/lib/Importer.pm
Todo
xt/critic.t
xt/perlcriticrc
Modified: branches/upstream/libsub-uplevel-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/MANIFEST.SKIP?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/MANIFEST.SKIP (original)
+++ branches/upstream/libsub-uplevel-perl/current/MANIFEST.SKIP Tue Nov 17 19:37:59 2009
@@ -16,6 +16,7 @@
# Module::Build
^Build$
^_build
+^MYMETA
# Temp, old, vi and emacs files.
~$
Modified: branches/upstream/libsub-uplevel-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/META.yml?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/META.yml (original)
+++ branches/upstream/libsub-uplevel-perl/current/META.yml Tue Nov 17 19:37:59 2009
@@ -1,30 +1,33 @@
---
-name: Sub-Uplevel
-version: 0.2002
+abstract: 'apparently run a function in a higher stack frame'
author:
- 'David A. Golden <dagolden at cpan.org>'
-abstract: apparently run a function in a higher stack frame
-license: perl
-resources:
- license: http://dev.perl.org/licenses/
-requires:
- perl: 5.006
build_requires:
Carp: 0
Test::More: 0.47
-provides:
- DB:
- file: lib/Sub/Uplevel.pm
- Sub::Uplevel:
- file: lib/Sub/Uplevel.pm
- version: 0.2002
-generated_by: Module::Build version 0.280801
+configure_requires:
+ Module::Build: 0.35
+generated_by: 'Module::Build version 0.3508'
+license: perl
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Sub-Uplevel
no_index:
directory:
- examples
- inc
package:
- DB
+provides:
+ DB:
+ file: lib/Sub/Uplevel.pm
+ Sub::Uplevel:
+ file: lib/Sub/Uplevel.pm
+ version: 0.22
+requires:
+ perl: 5.006
+resources:
+ license: http://dev.perl.org/licenses/
+ repository: http://github.com/dagolden/sub-uplevel
+version: 0.22
Modified: branches/upstream/libsub-uplevel-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/Makefile.PL?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/Makefile.PL (original)
+++ branches/upstream/libsub-uplevel-perl/current/Makefile.PL Tue Nov 17 19:37:59 2009
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.2808_01
+# Note: this file was auto-generated by Module::Build::Compat version 0.35_08
require 5.006;
use ExtUtils::MakeMaker;
WriteMakefile
Modified: branches/upstream/libsub-uplevel-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/README?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/README (original)
+++ branches/upstream/libsub-uplevel-perl/current/README Tue Nov 17 19:37:59 2009
@@ -2,7 +2,7 @@
Sub::Uplevel - apparently run a function in a higher stack frame
VERSION
- This documentation describes version 0.2002
+ This documentation describes version 0.22
SYNOPSIS
use Sub::Uplevel;
@@ -33,7 +33,7 @@
caller($frames) it will actually give caller($frames + $num_frames)
for them.
- "uplevel(1, \&some_func, @_)" is effectively "goto &some_func" but
+ `uplevel(1, \&some_func, @_)' is effectively `goto &some_func' but
you don't immediately exit the current subroutine. So while you
can't do this:
@@ -52,7 +52,7 @@
return @out;
}
- "uplevel" will issue a warning if $num_frames is more than the
+ `uplevel' will issue a warning if `$num_frames' is more than the
current call stack depth.
EXAMPLE
@@ -73,7 +73,8 @@
BUGS and CAVEATS
Well, the bad news is uplevel() is about 5 times slower than a normal
- function call. XS implementation anyone?
+ function call. XS implementation anyone? It also slows down every
+ invocation of caller(), regardless of whether uplevel() is in effect.
Sub::Uplevel overrides CORE::GLOBAL::caller temporarily for the scope of
each uplevel call. It does its best to work with any previously existing
@@ -82,6 +83,20 @@
However, if you are routinely using multiple modules that override
CORE::GLOBAL::caller, you are probably asking for trouble.
+
+ You should load Sub::Uplevel as early as possible within your program.
+ As with all CORE::GLOBAL overloading, the overload will not affect
+ modules that have already been compiled prior to the overload. One
+ module that often is unavoidably loaded prior to Sub::Uplevel is
+ Exporter. To forceably recompile Exporter (and Exporter::Heavy) after
+ loading Sub::Uplevel, use it with the ":aggressive" tag:
+
+ use Sub::Uplevel qw/:aggressive/;
+
+ The private function `Sub::Uplevel::_force_reload()' may be passed a
+ list of additional modules to reload if ":aggressive" is not aggressive
+ enough. Reloading modules may break things, so only use this as a last
+ resort.
As of version 0.20, Sub::Uplevel requires Perl 5.6 or greater.
Modified: branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pm?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pm (original)
+++ branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pm Tue Nov 17 19:37:59 2009
@@ -2,30 +2,47 @@
use 5.006;
use strict;
-our $VERSION = '0.2002';
+our $VERSION = '0.22';
$VERSION = eval $VERSION;
+
+# We must override *CORE::GLOBAL::caller if it hasn't already been
+# overridden or else Perl won't see our local override later.
+
+if ( not defined *CORE::GLOBAL::caller{CODE} ) {
+ *CORE::GLOBAL::caller = \&_normal_caller;
+}
+
+# modules to force reload if ":aggressive" is specified
+my @reload_list = qw/Exporter Exporter::Heavy/;
sub import {
no strict 'refs';
my ($class, @args) = @_;
- for my $fcn ( @args ) {
- if ( $fcn ne 'uplevel' ) {
- die qq{"$fcn" is not exported by the $class module\n}
+ for my $tag ( @args, 'uplevel' ) {
+ if ( $tag eq 'uplevel' ) {
+ my $caller = caller(0);
+ *{"$caller\::uplevel"} = \&uplevel;
+ }
+ elsif( $tag eq ':aggressive' ) {
+ _force_reload( @reload_list );
+ }
+ else {
+ die qq{"$tag" is not exported by the $class module\n}
}
}
- my $caller = caller(0);
- *{"$caller\::uplevel"} = \&uplevel;
return;
}
-# We must override *CORE::GLOBAL::caller if it hasn't already been
-# overridden or else Perl won't see our local override later.
-
-if ( not defined *CORE::GLOBAL::caller{CODE} ) {
- *CORE::GLOBAL::caller = \&_normal_caller;
-}
-
-
+sub _force_reload {
+ no warnings 'redefine';
+ local $^W = 0;
+ for my $m ( @_ ) {
+ $m =~ s{::}{/}g;
+ $m .= ".pm";
+ require $m if delete $INC{$m};
+ }
+}
+
=head1 NAME
Sub::Uplevel - apparently run a function in a higher stack frame
@@ -280,7 +297,8 @@
=head1 BUGS and CAVEATS
Well, the bad news is uplevel() is about 5 times slower than a normal
-function call. XS implementation anyone?
+function call. XS implementation anyone? It also slows down every invocation
+of caller(), regardless of whether uplevel() is in effect.
Sub::Uplevel overrides CORE::GLOBAL::caller temporarily for the scope of
each uplevel call. It does its best to work with any previously existing
@@ -290,6 +308,19 @@
However, if you are routinely using multiple modules that override
CORE::GLOBAL::caller, you are probably asking for trouble.
+You B<should> load Sub::Uplevel as early as possible within your program. As
+with all CORE::GLOBAL overloading, the overload will not affect modules that
+have already been compiled prior to the overload. One module that often is
+unavoidably loaded prior to Sub::Uplevel is Exporter. To forceably recompile
+Exporter (and Exporter::Heavy) after loading Sub::Uplevel, use it with the
+":aggressive" tag:
+
+ use Sub::Uplevel qw/:aggressive/;
+
+The private function C<Sub::Uplevel::_force_reload()> may be passed a list of
+additional modules to reload if ":aggressive" is not aggressive enough.
+Reloading modules may break things, so only use this as a last resort.
+
As of version 0.20, Sub::Uplevel requires Perl 5.6 or greater.
=head1 HISTORY
Modified: branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pod?rev=47379&op=diff
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pod (original)
+++ branches/upstream/libsub-uplevel-perl/current/lib/Sub/Uplevel.pod Tue Nov 17 19:37:59 2009
@@ -8,7 +8,7 @@
=head1 VERSION
-This documentation describes version 0.2002
+This documentation describes version 0.22
=head1 SYNOPSIS
@@ -137,7 +137,8 @@
=head1 BUGS and CAVEATS
Well, the bad news is uplevel() is about 5 times slower than a normal
-function call. XS implementation anyone?
+function call. XS implementation anyone? It also slows down every invocation
+of caller(), regardless of whether uplevel() is in effect.
Sub::Uplevel overrides CORE::GLOBAL::caller temporarily for the scope of
each uplevel call. It does its best to work with any previously existing
@@ -146,6 +147,19 @@
However, if you are routinely using multiple modules that override
CORE::GLOBAL::caller, you are probably asking for trouble.
+
+You B<should> load Sub::Uplevel as early as possible within your program. As
+with all CORE::GLOBAL overloading, the overload will not affect modules that
+have already been compiled prior to the overload. One module that often is
+unavoidably loaded prior to Sub::Uplevel is Exporter. To forceably recompile
+Exporter (and Exporter::Heavy) after loading Sub::Uplevel, use it with the
+":aggressive" tag:
+
+ use Sub::Uplevel qw/:aggressive/;
+
+The private function C<Sub::Uplevel::_force_reload()> may be passed a list of
+additional modules to reload if ":aggressive" is not aggressive enough.
+Reloading modules may break things, so only use this as a last resort.
As of version 0.20, Sub::Uplevel requires Perl 5.6 or greater.
Added: branches/upstream/libsub-uplevel-perl/current/t/08_exporter.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/t/08_exporter.t?rev=47379&op=file
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/t/08_exporter.t (added)
+++ branches/upstream/libsub-uplevel-perl/current/t/08_exporter.t Tue Nov 17 19:37:59 2009
@@ -1,0 +1,15 @@
+use lib qw(t/lib);
+use strict;
+use Test::More;
+
+plan tests => 1;
+
+# Goal of these tests: confirm that Sub::Uplevel will work with Exporter's
+# import() function
+
+package main;
+require Importer;
+require Bar;
+Importer::import_for_me('Bar','func3');
+can_ok('main','func3');
+
Added: branches/upstream/libsub-uplevel-perl/current/t/lib/Bar.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/t/lib/Bar.pm?rev=47379&op=file
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/t/lib/Bar.pm (added)
+++ branches/upstream/libsub-uplevel-perl/current/t/lib/Bar.pm Tue Nov 17 19:37:59 2009
@@ -1,0 +1,8 @@
+package Bar;
+use warnings;
+use strict;
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw( func3 );
+sub func3 { 3 }
+1;
Added: branches/upstream/libsub-uplevel-perl/current/t/lib/Importer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsub-uplevel-perl/current/t/lib/Importer.pm?rev=47379&op=file
==============================================================================
--- branches/upstream/libsub-uplevel-perl/current/t/lib/Importer.pm (added)
+++ branches/upstream/libsub-uplevel-perl/current/t/lib/Importer.pm Tue Nov 17 19:37:59 2009
@@ -1,0 +1,15 @@
+package Importer;
+use warnings;
+use strict;
+use Sub::Uplevel qw/:aggressive/;
+sub import_for_me {
+ my ($pkg, @p) = @_;
+ my $level = 1;
+ my $import = $pkg->can('import');
+ if ($import) {
+ uplevel $level, $import, ($pkg, @p);
+ } else {
+ warn "no import in $pkg\n";
+ }
+}
+1;
More information about the Pkg-perl-cvs-commits
mailing list