Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only add indexed modules to a file document.
In the case of Package::Stash 0.36 the first-in logic was preferring
t/lib/Package/Stash.pm over lib/Package/Stash.pm

Fixes #331.
  • Loading branch information
oalders committed Aug 21, 2014
1 parent 19caae0 commit f21555f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/MetaCPAN/Script/Release.pm
Expand Up @@ -16,7 +16,7 @@ use File::Temp ();
use File::stat ();
use LWP::UserAgent;
use List::MoreUtils ();
use List::Util ();
use List::Util qw( first );
use Log::Contextual qw( :log :dlog );
use MetaCPAN::Document::Author;
use MetaCPAN::Script::Latest;
Expand Down Expand Up @@ -327,12 +327,14 @@ sub import_tarball {

# find modules
my @modules;

if ( my %provides = %{ $meta->provides } ) {
while ( my ( $module, $data ) = each %provides ) {
my $path = $data->{file};

# FIXME: Could this match lib/Foo.pm and eg/lib/Foo.pm?
my $file = List::Util::first { $_->path =~ /\Q$path\E$/ } @files;
my $file
= first { $_->indexed && $_->path =~ /\Q$path\E$/ } @files;
next unless $file;
$file->add_module(
{
Expand Down

0 comments on commit f21555f

Please sign in to comment.