- Properly skip debugger test when optional deps not available
- Make sure pure-perl tests pass correctly on space-containing
paths (RT#77528)
+ - Remove all the pure-perl fallback code and depend on PP-capable
+ B::H::EOS 0.12
[0.23]
- Rely on B::Hooks::EndOfScope version 0.10 to fix issues with
my %RUN_DEPS = (
'Package::Stash' => '0.23',
+ 'B::Hooks::EndOfScope' => '0.12',
);
-my %OPT_RUN_DEPS = (can_cc() ? (
- 'B::Hooks::EndOfScope' => '0.10', # 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_005_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 ) : (),
-) : () );
+# these pieces are needed if using the debugger on the perl range
+my %OPT_RUN_DEPS = ( $] > 5.008_008_9 and $] < 5.013_005_1 and can_xs() )
+ # when changing versions, also change $sn_ver and $si_ver in namespace/clean.pm
+ ? ( 'Sub::Name' => '0.04', 'Sub::Identify' => '0.04' ) : ()
+;
my %META_BITS = (
resources => {
'VERSION_FROM' => 'lib/namespace/clean.pm',
'ABSTRACT' => 'Keep imports and functions out of your namespace',
'AUTHOR' => 'Robert \'phaylon\' Sedlacek <rs@474.at>, Florian Ragwitz <rafl@debian.org>, Jesse Luehrs <doy@tozt.net>',
-
- 'PREREQ_PM' => {
+ 'CONFIGURE_REQUIRES' => { 'ExtUtils::CBuilder' => 0.27 },
+ 'PREREQ_PM' => {
%RUN_DEPS, %OPT_RUN_DEPS,
$mymeta_works ? () : (%BUILD_DEPS),
},
WriteMakefile(%WriteMakefileArgs);
+# Secondary compile testing via ExtUtils::CBuilder
+sub can_xs {
+ # Do we have the configure_requires checker?
+ local $@;
+ eval "require ExtUtils::CBuilder;";
+ if (! $@ ) {
+ # They don't obey configure_requires, so it is
+ # someone old and delicate. Try to avoid hurting
+ # them by falling back to an older simpler test.
+ return can_cc();
+ }
+
+ return ExtUtils::CBuilder->new( quiet => 1 )->have_compiler;
+}
# can we locate a (the) C compiler
sub can_cc {
return;
}
-
-sub is_smoker {
- return ( $ENV{AUTOMATED_TESTING} && ! $ENV{PERL5_CPANM_IS_RUNNING} && ! $ENV{RELEASE_TESTING} )
-}
use warnings;
use strict;
-use vars qw( $STORAGE_VAR );
use Package::Stash;
our $VERSION = '0.23';
+our $STORAGE_VAR = '__NAMESPACE_CLEAN_STORAGE';
-$STORAGE_VAR = '__NAMESPACE_CLEAN_STORAGE';
-
-# FIXME - all of this buggery will migrate to B::H::EOS soon
-BEGIN {
- # when changing also change in Makefile.PL
- my $b_h_eos_req = '0.10';
-
- 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');
- }
- elsif ($] < 5.009_003_1) {
- require namespace::clean::_PP_OSE_5_8;
- *on_scope_end = \&namespace::clean::_PP_OSE_5_8::on_scope_end;
- }
- else {
- require namespace::clean::_PP_OSE;
- *on_scope_end = \&namespace::clean::_PP_OSE::on_scope_end;
- }
-}
+use B::Hooks::EndOfScope 'on_scope_end';
=head1 NAME
+++ /dev/null
-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;
+++ /dev/null
-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;
plan skip_all => "PP tests already executed"
if $ENV{NAMESPACE_CLEAN_USE_PP};
-eval { require B::Hooks::EndOfScope }
+eval { require Variable::Magic }
or plan skip_all => "PP tests already executed";
-# 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 };
+$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP';
+require B::Hooks::EndOfScope;
+ok( ($INC{'B/Hooks/EndOfScope/PP.pm'} && ! $INC{'B/Hooks/EndOfScope/XS.pm'}),
+ 'PP BHEOS loaded properly');
use Config;
use FindBin qw($Bin);
# for the $^X-es
$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
+
# rerun the tests under the assumption of pure-perl
my $this_file = quotemeta(__FILE__);
for my $fn (bsd_glob("$Bin/*.t")) {
next if $fn =~ /${this_file}$/;
- local $ENV{DEVEL_HIDE_VERBOSE} = 0;
- local $ENV{NAMESPACE_CLEAN_USE_PP} = 1 unless $has_d_h;
- my @cmd = (
- $^X,
- $has_d_h ? '-MDevel::Hide=B::Hooks::EndOfScope' : (),
- $fn
- );
+ my @cmd = ($^X, $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