From 610d68ff3c9288ff78f7b03801bce9f0df07cdbe Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 2 Nov 2014 02:32:38 +1300 Subject: [PATCH 1/2] CHI/Test.pm: Replace manual import stuff with Import::Into This is partially motivated by the fact Test::More is changing its exporter. CHI Test exposes this fact presently due to reaching into exporter internals, causing a breakage when they cease to exist. This change changes import syntax to use defined public import API to perform imports. --- lib/CHI/Test.pm | 47 +++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/lib/CHI/Test.pm b/lib/CHI/Test.pm index a1fc865..c4c8904 100644 --- a/lib/CHI/Test.pm +++ b/lib/CHI/Test.pm @@ -7,45 +7,36 @@ use List::MoreUtils qw(uniq); use Module::Runtime qw(require_module); use CHI; use CHI::Driver::Memory; +use Import::Into; use strict; use warnings; sub import { my $class = shift; - $class->export_to_level( 1, undef, @_ ); -} -sub packages_to_import { - return ( - qw( - Test::Deep - Test::More - Test::Exception - CHI::Test::Util - ) + # Test::Deep exports way too much by default + 'Test::Deep'->import::into( + 1, qw(eq_deeply cmp_deeply cmp_set cmp_bag + cmp_methods subbagof superbagof subsetof + supersetof superhashof subhashof) + ); + + # Exports all by default + 'Test::More'->import::into(1); + + # Exports all by default + 'Test::Exception'->import::into(1); + + # EXPORT_OK Only + 'CHI::Test::Util'->import::into( + 1, qw(activate_test_logger is_between + cmp_bool random_string skip_until) ); } sub export_to_level { my ( $class, $level, $ignore ) = @_; - - foreach my $package ( $class->packages_to_import() ) { - require_module($package); - my @export; - if ( $package eq 'Test::Deep' ) { - - # Test::Deep exports way too much by default - @export = - qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods subbagof superbagof subsetof supersetof superhashof subhashof); - } - else { - - # Otherwise, grab everything from @EXPORT - no strict 'refs'; - @export = @{"$package\::EXPORT"}; - } - $package->export_to_level( $level + 1, undef, @export ); - } + $class->import::into($level); } 1; From ba4a3a69a4dc305548a97560c4a0477749eeed25 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 2 Nov 2014 02:55:08 +1300 Subject: [PATCH 2/2] dist.ini: Fix Generated Makefile.PL getting pruned. Unfortunately, Phase order happens as such: - Add Files. - Remove Files - Munge Files - Finalise Installer https://metacpan.org/source/RJBS/Dist-Zilla-5.023/lib/Dist/Zilla/Dist/Builder.pm#L317 Which means without this patch, it does: GatherDir ( Imports Makefile.PL from disk ) MakeMaker ( Injects a templated Makefile.PL ) PruneFiles ( Removes both of the above ) MakeMaker ( Attempts to munge previously injected Makefile.PL and bails when it doesn't exist ) This patch resolves that by removing the problem file before it even gets added to dzil, eliminating conflict. --- dist.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist.ini b/dist.ini index f8b9198..a3615a3 100644 --- a/dist.ini +++ b/dist.ini @@ -16,11 +16,11 @@ repository.web = https://github.com/jonswar/perl-chi repository.type = git ; Build -[PruneFiles] -filenames = Makefile.PL [ExecDir] [ExtraTests] [GatherDir] +exclude_filename = Makefile.PL + [License] [MakeMaker] [ManifestSkip]