From: Vincent Pit Date: Tue, 18 Jan 2011 10:30:24 +0000 (+0100) Subject: Clean up the import replacement a bit X-Git-Tag: v0.03~19 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=commitdiff_plain;h=cafe4d866180397d8574bafef7a795fab1d2f155 Clean up the import replacement a bit --- diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index f1ee6ee..80cac13 100644 --- a/lib/Test/Leaner.pm +++ b/lib/Test/Leaner.pm @@ -180,6 +180,7 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { my $import = sub { shift; + my @imports = &_handle_import_args; @imports = @EXPORT unless @imports; my @test_more_imports; @@ -192,7 +193,10 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { *{$pkg."::$_"} = $leaner_stash->{$_}; } } + my $test_more_import = 'Test::More'->can('import'); + return unless $test_more_import; + @_ = ( 'Test::More', @_, @@ -202,6 +206,7 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { lock $plan if THREADSAFE; push @_, 'no_diag' if $no_diag; } + goto $test_more_import; };