commit 22a5ae1fd39816be341fe9d2d1d1af4a613f5dc9 Author: Slaven Rezic Date: Sun Sep 14 16:08:13 2014 +0200 fix for https://github.com/cpan-testers/CPAN-Reporter/issues/20 Call and exhaust the while(<>){} loop as early as possible, so checked modules using <> itself do not cause problems here. diff --git a/lib/CPAN/Reporter/PrereqCheck.pm b/lib/CPAN/Reporter/PrereqCheck.pm index 6545de2..cde00b7 100644 --- a/lib/CPAN/Reporter/PrereqCheck.pm +++ b/lib/CPAN/Reporter/PrereqCheck.pm @@ -11,11 +11,16 @@ _run() if ! caller(); sub _run { my %saw_mod; # read module and prereq string from STDIN + # do this as early as possible: https://github.com/cpan-testers/CPAN-Reporter/issues/20 + my @modules; + while ( <> ) { + push @modules, $_; + } local *DEVNULL; open DEVNULL, ">" . File::Spec->devnull; ## no critic # ensure actually installed, not ./inc/... or ./t/..., etc. local @INC = grep { $_ ne '.' } @INC; - while ( <> ) { + for (@modules) { m/^(\S+)\s+([^\n]*)/; my ($mod, $need) = ($1, $2); die "Couldn't read module for '$_'" unless $mod;