Skip to content

Commit 72814a7

Browse files
authored
Merge pull request #12 from cv-library/mce_fix
Apply fix from bug #9
2 parents 5f2e9ae + 8d70f66 commit 72814a7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/Test/Perl/Critic.pm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ sub all_critic_ok {
9292
my @files = Perl::Critic::Utils::all_perl_files(@dirs_or_files);
9393
croak 'Nothing to critique' if not @files;
9494

95-
my $have_mce = eval {require MCE::Grep};
95+
my $have_mce = eval { require MCE::Grep; MCE::Grep->import; 1 };
9696
return $have_mce ? _test_parallel(@files) : _test_serial(@files);
9797
}
9898

@@ -109,13 +109,15 @@ sub _test_parallel {
109109
# workers. So we disable the T::B sanity checks at the end of its life.
110110
$TEST->no_ending(1);
111111

112-
my $okays = MCE::Grep::mce_grep { critic_ok($_) } @files;
112+
my $okays = MCE::Grep->run( sub { critic_ok($_) }, @files );
113113
my $pass = $okays == @files;
114114

115115
# To make Test::Harness happy, we must emit a test plan and a sensible exit
116116
# status. Usually, T::B does this for us, but we disabled the ending above.
117117
$pass || eval 'END { $? = 1 }'; ## no critic qw(Eval Interpolation)
118-
return $TEST->done_testing(scalar @files);
118+
$TEST->done_testing(scalar @files);
119+
120+
return $pass;
119121
}
120122

121123
#---------------------------------------------------------------------------
@@ -126,6 +128,8 @@ sub _test_serial {
126128
my $okays = grep {critic_ok($_)} @files;
127129
my $pass = $okays == @files;
128130

131+
$TEST->done_testing(scalar @files);
132+
129133
return $pass;
130134
}
131135

0 commit comments

Comments
 (0)