Hello community,
here is the log from the commit of package perl-namespace-clean for
openSUSE:Factory checked in at 2012-02-14 11:25:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-namespace-clean (Old)
and /work/SRC/openSUSE:Factory/.perl-namespace-clean.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-namespace-clean", Maintainer is ""
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-namespace-clean/perl-namespace-clean.changes
2011-11-21 12:43:53.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.perl-namespace-clean.new/perl-namespace-clean.changes
2012-02-14 11:25:49.000000000 +0100
@@ -1,0 +2,17 @@
+Sat Feb 11 07:00:52 UTC 2012 - [email protected]
+
+- updated to 0.22
+ - Simplify the >= 5.10 PP variant even more - move the hook from
+ DESTROY into DELETE
+ - Force explicit callback invocation order on 5.8 PP
+ - Replace the %^H tie approach with fieldhashes, fixes all known
+ corner cases and caveats on supported perls >= 5.8.1 (FC)
+ - Compile away the debugger fixup on perls >= 5.15.5 (FC)
+ - More robust handling of the tied %^H in pure perl mode (RT#73402)
+ - Limit the debugger workarounds to perls between 5.8.8 and 5.14,
+ extend debugger support to all perl versions (FC) (RT#69862)
+ - If possible, automatically install (but not load) the debugger
+ workaround libraries on perls between 5.8.8 and 5.14 (RT#72368)
+ - Add back dropped NAME section (RT#70259)
+
+-------------------------------------------------------------------
Old:
----
namespace-clean-0.21.tar.gz
New:
----
namespace-clean-0.22.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-namespace-clean.spec ++++++
--- /var/tmp/diff_new_pack.M0OZvD/_old 2012-02-14 11:25:50.000000000 +0100
+++ /var/tmp/diff_new_pack.M0OZvD/_new 2012-02-14 11:25:50.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-namespace-clean
#
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,48 +16,44 @@
#
-
Name: perl-namespace-clean
-Version: 0.21
-Release: 1
-License: GPL-1.0+ or Artistic-1.0
+Version: 0.22
+Release: 0
%define cpan_name namespace-clean
Summary: Keep imports and functions out of your namespace
-Url: http://search.cpan.org/dist/namespace-clean/
+License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
-Source:
http://www.cpan.org/authors/id/R/RI/RIBASUSHI/namespace-clean-%{version}.tar.gz
+Url: http://search.cpan.org/dist/namespace-clean/
+Source:
http://www.cpan.org/authors/id/R/RI/RIBASUSHI/%{cpan_name}-%{version}.tar.gz
+# MANUAL
Patch1: perl-namespace-clean-use_lib.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(B::Hooks::EndOfScope) >= 0.07
-BuildRequires: perl(constant)
-BuildRequires: perl(Exporter)
-BuildRequires: perl(Package::Stash) >= 0.22
-BuildRequires: perl(Sub::Identify) >= 0.04
-BuildRequires: perl(Sub::Name) >= 0.04
-BuildRequires: perl(vars)
+BuildRequires: perl(Package::Stash) >= 0.23
BuildRequires: perl(Test::More) >= 0.88
+#BuildRequires: perl(CleaneeBridge)
+#BuildRequires: perl(CleaneeBridgeDirect)
+#BuildRequires: perl(CleaneeBridgeExplicit)
+#BuildRequires: perl(Devel::Hide)
+#BuildRequires: perl(ExporterTest)
+#BuildRequires: perl(Hash::Util::FieldHash)
+#BuildRequires: perl(InheritanceParent)
+#BuildRequires: perl(namespace::clean)
+#BuildRequires: perl(namespace::clean::_PP_OSE)
+#BuildRequires: perl(namespace::clean::_PP_OSE_5_8)
+#BuildRequires: perl(Sub::Identify)
+#BuildRequires: perl(Sub::Name)
+#BuildRequires: perl(Tie::StdHash)
Requires: perl(B::Hooks::EndOfScope) >= 0.07
-Requires: perl(Package::Stash) >= 0.22
-Requires: perl(Sub::Identify) >= 0.04
-Requires: perl(Sub::Name) >= 0.04
-Requires: perl(vars)
+Requires: perl(Package::Stash) >= 0.23
+Requires: perl(Test::More) >= 0.88
%{perl_requires}
%description
-Keeping packages clean
-When you define a function, or import one, into a Perl package, it will
-naturally also be available as a method. This does not per se cause
-problems, but it can complicate subclassing and, for example, plugin
-classes that are included via multiple inheritance by loading them as
-base classes.
-
-The 'namespace::clean' pragma will remove all previously declared or
-imported symbols at the end of the current package's compile cycle.
-Functions called in the package itself will still be bound by their
-name, but they won't show up as methods on your class or instances.
+Keep imports and functions out of your namespace
%prep
%setup -q -n %{cpan_name}-%{version}
@@ -78,11 +74,8 @@
%perl_process_packlist
%perl_gen_filelist
-%clean
-%{?buildroot:%__rm -rf "%{buildroot}"}
-
%files -f %{name}.files
-%defattr(644,root,root,755)
+%defattr(-,root,root,755)
%doc Changes
%changelog
++++++ namespace-clean-0.21.tar.gz -> namespace-clean-0.22.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/Changes
new/namespace-clean-0.22/Changes
--- old/namespace-clean-0.21/Changes 2011-08-03 23:46:30.000000000 +0200
+++ new/namespace-clean-0.22/Changes 2011-12-26 13:59:44.000000000 +0100
@@ -1,3 +1,21 @@
+ [0.22] (official fix of all the %^H ickyness)
+ - Simplify the >= 5.10 PP variant even more - move the hook from
+ DESTROY into DELETE
+ - Force explicit callback invocation order on 5.8 PP
+
+ [0.21_02]
+ - Replace the %^H tie approach with fieldhashes, fixes all known
+ corner cases and caveats on supported perls >= 5.8.1 (FC)
+ - Compile away the debugger fixup on perls >= 5.15.5 (FC)
+
+ [0.21_01]
+ - More robust handling of the tied %^H in pure perl mode (RT#73402)
+ - Limit the debugger workarounds to perls between 5.8.8 and 5.14,
+ extend debugger support to all perl versions (FC) (RT#69862)
+ - If possible, automatically install (but not load) the debugger
+ workaround libraries on perls between 5.8.8 and 5.14 (RT#72368)
+ - Add back dropped NAME section (RT#70259)
+
[0.21]
- When using the tie() fallback ensure we do not obliterate a
foreign tie()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/MANIFEST
new/namespace-clean-0.22/MANIFEST
--- old/namespace-clean-0.21/MANIFEST 2011-08-03 23:47:46.000000000 +0200
+++ new/namespace-clean-0.22/MANIFEST 2011-12-26 13:59:53.000000000 +0100
@@ -1,5 +1,7 @@
Changes
lib/namespace/clean.pm
+lib/namespace/clean/_PP_OSE.pm
+lib/namespace/clean/_PP_OSE_5_8.pm
Makefile.PL
MANIFEST This list of files
t/00-basic.t
@@ -10,7 +12,9 @@
t/05-explicit-cleanee.t
t/05-syntax-error.t
t/06-other-types.t
+t/07-debugger.t
t/08-const-sub.t
+t/09-fiddle-hinthash.t
t/10-pure-perl.t
t/lib/CleaneeBridge.pm
t/lib/CleaneeBridgeDirect.pm
@@ -22,5 +26,5 @@
t/lib/OtherTypes.pm
t/lib/SyntaxError.pm
t/lib/Unimport.pm
-xt/author/07-debugger.t
-META.yml Module meta-data (added by MakeMaker)
+META.yml Module YAML meta-data (added by
MakeMaker)
+META.json Module JSON meta-data (added by
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/META.json
new/namespace-clean-0.22/META.json
--- old/namespace-clean-0.21/META.json 1970-01-01 01:00:00.000000000 +0100
+++ new/namespace-clean-0.22/META.json 2011-12-26 13:59:53.000000000 +0100
@@ -0,0 +1,50 @@
+{
+ "abstract" : "Keep imports and functions out of your namespace",
+ "author" : [
+ "Robert 'phaylon' Sedlacek <[email protected]>, Florian Ragwitz
<[email protected]>, Jesse Luehrs <[email protected]>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter
version 2.112621",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "namespace-clean",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "Test::More" : "0.88"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : 0
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Package::Stash" : "0.23"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" :
"http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean"
+ },
+ "homepage" : "http://search.cpan.org/dist/namespace-clean",
+ "repository" : {
+ "url" : "git://git.shadowcat.co.uk/p5sagit/namespace-clean.git"
+ }
+ },
+ "version" : "0.22"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/META.yml
new/namespace-clean-0.22/META.yml
--- old/namespace-clean-0.21/META.yml 2011-08-03 23:47:46.000000000 +0200
+++ new/namespace-clean-0.22/META.yml 2011-12-26 13:59:53.000000000 +0100
@@ -1,26 +1,26 @@
---- #YAML:1.0
-name: namespace-clean
-version: 0.21
-abstract: Keep imports and functions out of your namespace
+---
+abstract: 'Keep imports and functions out of your namespace'
author:
- - Robert 'phaylon' Sedlacek <[email protected]>, Florian Ragwitz
<[email protected]>, Jesse Luehrs <[email protected]>
-license: perl
-distribution_type: module
-configure_requires:
- ExtUtils::MakeMaker: 0
+ - "Robert 'phaylon' Sedlacek <[email protected]>, Florian Ragwitz
<[email protected]>, Jesse Luehrs <[email protected]>"
build_requires:
- Test::More: 0.88
+ Test::More: 0.88
+configure_requires:
+ ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter
version 2.112621'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: namespace-clean
+no_index:
+ directory:
+ - t
+ - inc
requires:
- Package::Stash: 0.23
+ Package::Stash: 0.23
resources:
- bugtracker:
http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean
- homepage: http://search.cpan.org/dist/namespace-clean
- repository: git://git.shadowcat.co.uk/p5sagit/namespace-clean.git
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.57_05
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean
+ homepage: http://search.cpan.org/dist/namespace-clean
+ repository: git://git.shadowcat.co.uk/p5sagit/namespace-clean.git
+version: 0.22
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/Makefile.PL
new/namespace-clean-0.22/Makefile.PL
--- old/namespace-clean-0.21/Makefile.PL 2011-08-03 23:46:29.000000000
+0200
+++ new/namespace-clean-0.22/Makefile.PL 2011-12-21 11:02:40.000000000
+0100
@@ -16,8 +16,16 @@
);
my %OPT_RUN_DEPS = (can_cc() ? (
- 'B::Hooks::EndOfScope' => '0.07', # when changing, also change version in
namespace/clean.pm
- is_smoker() ? ( 'Devel::Hide' => 0 ) : (), # make sure we smoke the
pure-perl version
+ 'B::Hooks::EndOfScope' => '0.07', # when changing, also change $b_h_eos_req
in namespace/clean.pm
+
+ # these pieces are needed if using the debugger on the perl range
+ ($] > 5.008_008_9 && $] < 5.013_006_1)
+ ? ( 'Sub::Name' => '0.04', 'Sub::Identify' => '0.04' ) # when changing,
also change $sn_ver and $si_ver in namespace/clean.pm
+ : ()
+ ,
+
+ # make sure we smoke the pure-perl version
+ is_smoker() ? ( 'Devel::Hide' => 0 ) : (),
) : () );
my %META_BITS = (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/lib/namespace/clean/_PP_OSE.pm
new/namespace-clean-0.22/lib/namespace/clean/_PP_OSE.pm
--- old/namespace-clean-0.21/lib/namespace/clean/_PP_OSE.pm 1970-01-01
01:00:00.000000000 +0100
+++ new/namespace-clean-0.22/lib/namespace/clean/_PP_OSE.pm 2011-12-23
00:16:01.000000000 +0100
@@ -0,0 +1,40 @@
+package # hide from the pauses
+ namespace::clean::_PP_OSE;
+
+use warnings;
+use strict;
+
+use Tie::Hash;
+use Hash::Util::FieldHash 'fieldhash';
+
+# Here we rely on a combination of several behaviors:
+#
+# * %^H is deallocated on scope exit, so any references to it disappear
+# * A lost weakref in a fieldhash causes the corresponding key to be deleted
+# * Deletion of a key on a tied hash triggers DELETE
+#
+# Therefore the DELETE of a tied fieldhash containing a %^H reference will
+# be the hook to fire all our callbacks.
+
+fieldhash my %hh;
+{
+ package # hide from pause too
+ namespace::clean::_TieHintHashFieldHash;
+ use base 'Tie::StdHash';
+ sub DELETE {
+ my $ret = shift->SUPER::DELETE(@_);
+ $_->() for @$ret;
+ $ret;
+ }
+}
+
+sub on_scope_end (&) {
+ $^H |= 0x020000;
+
+ tie(%hh, 'namespace::clean::_TieHintHashFieldHash')
+ unless tied %hh;
+
+ push @{ $hh{\%^H} ||= [] }, shift;
+}
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/namespace-clean-0.21/lib/namespace/clean/_PP_OSE_5_8.pm
new/namespace-clean-0.22/lib/namespace/clean/_PP_OSE_5_8.pm
--- old/namespace-clean-0.21/lib/namespace/clean/_PP_OSE_5_8.pm 1970-01-01
01:00:00.000000000 +0100
+++ new/namespace-clean-0.22/lib/namespace/clean/_PP_OSE_5_8.pm 2011-12-23
17:16:43.000000000 +0100
@@ -0,0 +1,26 @@
+package # hide from the pauses
+ namespace::clean::_PP_OSE_5_8;
+
+use warnings;
+use strict;
+
+# This is the original implementation, which sadly is broken
+# on perl 5.10+ withing string evals
+sub on_scope_end (&) {
+ $^H |= 0x020000;
+
+ push @{
+ $^H{'__namespace::clean__guardstack__'}
+ ||= bless ([], 'namespace::clean::_PP_SG_STACK')
+ }, shift;
+}
+
+package # hide from the pauses
+ namespace::clean::_PP_SG_STACK;
+
+use warnings;
+use strict;
+
+sub DESTROY { $_->() for @{$_[0]} }
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/lib/namespace/clean.pm
new/namespace-clean-0.22/lib/namespace/clean.pm
--- old/namespace-clean-0.21/lib/namespace/clean.pm 2011-08-03
23:46:30.000000000 +0200
+++ new/namespace-clean-0.22/lib/namespace/clean.pm 2011-12-26
13:56:08.000000000 +0100
@@ -1,5 +1,4 @@
package namespace::clean;
-# ABSTRACT: Keep imports and functions out of your namespace
use warnings;
use strict;
@@ -7,89 +6,35 @@
use vars qw( $STORAGE_VAR );
use Package::Stash;
-our $VERSION = '0.21';
+our $VERSION = '0.22';
$STORAGE_VAR = '__NAMESPACE_CLEAN_STORAGE';
+# FIXME - all of this buggery will migrate to B::H::EOS soon
BEGIN {
-
- use warnings;
- use strict;
-
# when changing also change in Makefile.PL
my $b_h_eos_req = '0.07';
- if (eval {
+ if (! $ENV{NAMESPACE_CLEAN_USE_PP} and eval {
require B::Hooks::EndOfScope;
B::Hooks::EndOfScope->VERSION($b_h_eos_req);
1
} ) {
B::Hooks::EndOfScope->import('on_scope_end');
}
- else {
- eval <<'PP' or die $@;
-
- use Tie::Hash ();
-
- {
- package namespace::clean::_TieHintHash;
-
- use warnings;
- use strict;
-
- use base 'Tie::ExtraHash';
+ elsif ($] < 5.009_003_1) {
+ require namespace::clean::_PP_OSE_5_8;
+ *on_scope_end = \&namespace::clean::_PP_OSE_5_8::on_scope_end;
}
-
- {
- package namespace::clean::_ScopeGuard;
-
- use warnings;
- use strict;
-
- sub arm { bless [ $_[1] ] }
-
- sub DESTROY { $_[0]->[0]->() }
- }
-
-
- sub on_scope_end (&) {
- $^H |= 0x020000;
-
- if( my $stack = tied( %^H ) ) {
- if ( (my $c = ref $stack) ne 'namespace::clean::_TieHintHash') {
- die <<EOE;
-========================================================================
- !!! F A T A L E R R O R !!!
-
- foreign tie() of %^H detected
-========================================================================
-
-namespace::clean is currently operating in pure-perl fallback mode, because
-your system is lacking the necessary dependency B::Hooks::EndOfScope
$b_h_eos_req.
-In this mode namespace::clean expects to be able to tie() the hinthash %^H,
-however it is apparently already tied by means unknown to the tie-class
-$c
-
-Since this is a no-win situation execution will abort here and now. Please
-try to find out which other module is relying on hinthash tie() ability,
-and file a bug for both the perpetrator and namespace::clean, so that the
-authors can figure out an acceptable way of moving forward.
-
-EOE
- }
- push @$stack, namespace::clean::_ScopeGuard->arm(shift);
- }
- else {
- tie( %^H, 'namespace::clean::_TieHintHash',
namespace::clean::_ScopeGuard->arm(shift) );
- }
+ else {
+ require namespace::clean::_PP_OSE;
+ *on_scope_end = \&namespace::clean::_PP_OSE::on_scope_end;
}
+}
- 1;
-
-PP
+=head1 NAME
- }
-}
+namespace::clean - Keep imports and functions out of your namespace
=head1 SYNOPSIS
@@ -219,27 +164,58 @@
=cut
+# Constant to optimise away the unused code branches
+use constant FIXUP_NEEDED => $] < 5.015_005_1;
+use constant FIXUP_RENAME_SUB => $] > 5.008_008_9 && $] < 5.013_006_1;
+{
+ no strict;
+ delete ${__PACKAGE__."::"}{FIXUP_NEEDED};
+ delete ${__PACKAGE__."::"}{FIXUP_RENAME_SUB};
+}
+
+# Debugger fixup necessary before perl 5.15.5
+#
+# In perl 5.8.9-5.12, it assumes that sub_fullname($sub) can
+# always be used to find the CV again.
+# In perl 5.8.8 and 5.14, it assumes that the name of the glob
+# passed to entersub can be used to find the CV.
+# since we are deleting the glob where the subroutine was originally
+# defined, those assumptions no longer hold.
+#
+# So in 5.8.9-5.12 we need to move it elsewhere and point the
+# CV's name to the new glob.
+#
+# In 5.8.8 and 5.14 we move it elsewhere and rename the
+# original glob by assigning the new glob back to it.
my $sub_utils_loaded;
-my $DebuggerRename = sub {
+my $DebuggerFixup = sub {
my ($f, $sub, $cleanee_stash, $deleted_stash) = @_;
- if (! defined $sub_utils_loaded ) {
- $sub_utils_loaded = do {
- my $sn_ver = 0.04;
- eval { require Sub::Name; Sub::Name->VERSION($sn_ver) }
- or die "Sub::Name $sn_ver required when running under -d or
equivalent: $@";
-
- my $si_ver = 0.04;
- eval { require Sub::Identify; Sub::Identify->VERSION($si_ver) }
- or die "Sub::Identify $si_ver required when running under -d or
equivalent: $@";
+ if (FIXUP_RENAME_SUB) {
+ if (! defined $sub_utils_loaded ) {
+ $sub_utils_loaded = do {
+
+ # when changing version also change in Makefile.PL
+ my $sn_ver = 0.04;
+ eval { require Sub::Name; Sub::Name->VERSION($sn_ver) }
+ or die "Sub::Name $sn_ver required when running under -d or
equivalent: $@";
+
+ # when changing version also change in Makefile.PL
+ my $si_ver = 0.04;
+ eval { require Sub::Identify; Sub::Identify->VERSION($si_ver) }
+ or die "Sub::Identify $si_ver required when running under -d or
equivalent: $@";
- 1;
- } ? 1 : 0;
- }
+ 1;
+ } ? 1 : 0;
+ }
- if ( Sub::Identify::sub_fullname($sub) eq ($cleanee_stash->name . "::$f") ) {
- my $new_fq = $deleted_stash->name . "::$f";
- Sub::Name::subname($new_fq, $sub);
+ if ( Sub::Identify::sub_fullname($sub) eq ($cleanee_stash->name . "::$f")
) {
+ my $new_fq = $deleted_stash->name . "::$f";
+ Sub::Name::subname($new_fq, $sub);
+ $deleted_stash->add_symbol("&$f", $sub);
+ }
+ }
+ else {
$deleted_stash->add_symbol("&$f", $sub);
}
};
@@ -259,18 +235,23 @@
my $sub = $cleanee_stash->get_symbol("&$f")
or next SYMBOL;
- if ($^P and ref(\$cleanee_stash->namespace->{$f}) eq 'GLOB') {
- # convince the Perl debugger to work
- # it assumes that sub_fullname($sub) can always be used to find
the CV again
- # since we are deleting the glob where the subroutine was
originally
- # defined, that assumption no longer holds, so we need to move it
- # elsewhere and point the CV's name to the new glob.
- $DebuggerRename->(
- $f,
- $sub,
- $cleanee_stash,
- $deleted_stash ||=
Package::Stash->new("namespace::clean::deleted::$cleanee"),
- );
+ my $need_debugger_fixup =
+ FIXUP_NEEDED
+ &&
+ $^P
+ &&
+ ref(my $globref = \$cleanee_stash->namespace->{$f}) eq 'GLOB'
+ ;
+
+ if (FIXUP_NEEDED && $need_debugger_fixup) {
+ # convince the Perl debugger to work
+ # see the comment on top of $DebuggerFixup
+ $DebuggerFixup->(
+ $f,
+ $sub,
+ $cleanee_stash,
+ $deleted_stash ||=
Package::Stash->new("namespace::clean::deleted::$cleanee"),
+ );
}
my @symbols = map {
@@ -281,6 +262,13 @@
$cleanee_stash->remove_glob($f);
+ # if this perl needs no renaming trick we need to
+ # rename the original glob after the fact
+ # (see commend of $DebuggerFixup
+ if (FIXUP_NEEDED && !FIXUP_RENAME_SUB && $need_debugger_fixup) {
+ *$globref = $deleted_stash->namespace->{$f};
+ }
+
$cleanee_stash->add_symbol(@$_) for @symbols;
}
};
@@ -434,17 +422,6 @@
Just for completeness sake, if you want to remove the symbol completely,
use C<undef> instead.
-=head1 CAVEATS
-
-This module is fully functional in a pure-perl environment, where
-L<B::Hooks::EndOfScope> (with the XS dependency L<Variable::Magic>), may
-not be available. However in this case this module falls back to a
-L<tie()|perlfunc/tie> of L<%^H|perlvar/%^H> which may or may not interfere
-with some crack you may be doing independently of namespace::clean.
-
-If you want to ensure that your codebase is protected from this unlikely
-clash, you need to explicitly depend on L<B::Hooks::EndOfScope>.
-
=head1 SEE ALSO
L<B::Hooks::EndOfScope>
@@ -473,11 +450,15 @@
Peter Rabbitson <[email protected]>
+=item *
+
+Father Chrysostomos <[email protected]>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2011 by Robert 'phaylon' Sedlacek.
+This software is copyright (c) 2011 by L</AUTHORS>
This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/t/07-debugger.t
new/namespace-clean-0.22/t/07-debugger.t
--- old/namespace-clean-0.21/t/07-debugger.t 1970-01-01 01:00:00.000000000
+0100
+++ new/namespace-clean-0.22/t/07-debugger.t 2011-12-21 10:50:20.000000000
+0100
@@ -0,0 +1,39 @@
+use Test::More;
+
+BEGIN {
+ # shut up the debugger
+ $ENV{PERLDB_OPTS} = 'NonStop';
+
+ # work aroud the regex + P::S::XS buggery on
+ # < 5.8.6
+ require Package::Stash;
+}
+
+BEGIN {
+
+#line 1
+#!/usr/bin/perl -d
+#line 10
+
+}
+
+{
+ package Foo;
+
+ BEGIN { *baz = sub { 42 } }
+ sub foo { 22 }
+
+ use namespace::clean;
+
+ sub bar {
+ ::is(baz(), 42);
+ ::is(foo(), 22);
+ }
+}
+
+ok( !Foo->can("foo"), "foo cleaned up" );
+ok( !Foo->can("baz"), "baz cleaned up" );
+
+Foo->bar();
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/t/09-fiddle-hinthash.t
new/namespace-clean-0.22/t/09-fiddle-hinthash.t
--- old/namespace-clean-0.21/t/09-fiddle-hinthash.t 1970-01-01
01:00:00.000000000 +0100
+++ new/namespace-clean-0.22/t/09-fiddle-hinthash.t 2011-12-22
12:07:06.000000000 +0100
@@ -0,0 +1,53 @@
+use strict;
+use warnings;
+
+use Test::More 0.88;
+
+{
+ package Bar;
+ use sort 'stable';
+ use namespace::clean;
+ use sort 'stable';
+ {
+ 1;
+ }
+
+ Test::More::pass('no segfault');
+}
+
+{
+ package Foo;
+ BEGIN {
+ $^H{'foo'} = 'bar';
+ }
+
+ use namespace::clean;
+
+ BEGIN {
+ Test::More::is( $^H{'foo'}, 'bar', 'compiletime hinthash intact after
n::c' );
+ }
+
+ {
+ BEGIN {
+ Test::More::is(
+ $^H{'foo'}, 'bar', 'compile-time hinthash intact in inner scope'
+ );
+ }
+ 1;
+ }
+
+ BEGIN {
+ SKIP: {
+ Test::More::skip(
+ 'Tied hinthash values not present in extended caller() on perls older
than 5.10'
+ .', regardless of mode (PP or XS)',
+ 1
+ ) if ($] < 5.010_000);
+ package DB;
+ Test::More::is( ( (caller(0))[10] || {} )->{foo}, 'bar', 'hinthash
values visible in caller' );
+ }
+ }
+}
+
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/t/10-pure-perl.t
new/namespace-clean-0.22/t/10-pure-perl.t
--- old/namespace-clean-0.21/t/10-pure-perl.t 2011-07-31 05:32:06.000000000
+0200
+++ new/namespace-clean-0.22/t/10-pure-perl.t 2011-12-22 12:20:21.000000000
+0100
@@ -2,11 +2,15 @@
use warnings;
use Test::More;
+plan skip_all => "PP tests already executed"
+ if $ENV{NAMESPACE_CLEAN_USE_PP};
+
eval { require B::Hooks::EndOfScope }
or plan skip_all => "PP tests already executed";
-eval { require Devel::Hide }
- or plan skip_all => "Devel::Hide required for this test in presence of
B::Hooks::EndOfScope";
+# the PP tests will run either wih D::H (mainly on smokers)
+# or by setting the envvar (for users)
+my $has_d_h = eval { require Devel::Hide };
use Config;
use FindBin qw($Bin);
@@ -22,7 +26,12 @@
next if $fn =~ /${this_file}$/;
local $ENV{DEVEL_HIDE_VERBOSE} = 0;
- my @cmd = ( $^X, '-MDevel::Hide=B::Hooks::EndOfScope', $fn );
+ local $ENV{NAMESPACE_CLEAN_USE_PP} = 1 unless $has_d_h;
+ my @cmd = (
+ $^X,
+ $has_d_h ? '-MDevel::Hide=B::Hooks::EndOfScope' : (),
+ $fn
+ );
# this is cheating, and may even hang here and there (testing on windows
passed fine)
# if it does - will have to fix it somehow (really *REALLY* don't want to
pull
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/namespace-clean-0.21/xt/author/07-debugger.t
new/namespace-clean-0.22/xt/author/07-debugger.t
--- old/namespace-clean-0.21/xt/author/07-debugger.t 2011-07-26
16:56:10.000000000 +0200
+++ new/namespace-clean-0.22/xt/author/07-debugger.t 1970-01-01
01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-use Test::More;
-
-BEGIN {
- plan skip_all => 'Only applicable on perl >= 5.8.9'
- if $] <= 5.008008;
-
-#line 1
-#!/usr/bin/perl -d
-#line 10
-
- push @DB::typeahead, "c", "q";
-
- # try to shut it up at least a little bit
- open my $out, ">", \my $out_buf;
- $DB::OUT = $out;
- open my $in, "<", \my $in_buf;
- $DB::IN = $in;
-}
-
-{
- package Foo;
-
- BEGIN { *baz = sub { 42 } }
- sub foo { 22 }
-
- use namespace::clean;
-
- sub bar {
- ::is(baz(), 42);
- ::is(foo(), 22);
- }
-}
-
-ok( !Foo->can("foo"), "foo cleaned up" );
-ok( !Foo->can("baz"), "baz cleaned up" );
-
-Foo->bar();
-
-done_testing;
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]