File tree Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -481,15 +481,16 @@ sub _modules_from_meta {
481481
482482 my $provides = $self -> metadata-> provides;
483483 my $files = $self -> files;
484+ my %files = map +( $_ -> path => $_ ), @$files ;
484485 foreach my $module ( sort keys %$provides ) {
485486 my $data = $provides -> {$module };
486487 my $path = File::Spec-> canonpath( $data -> {file } );
487488
488- # Obey no_index and take the shortest path if multiple files match.
489- my ($file ) = sort { length ( $a -> path ) <=> length ( $b -> path ) }
490- grep { $_ -> indexed && $_ -> path =~ / \Q $path \E $ / } @$files ;
489+ my $file = $files {$path }
490+ or next ;
491+
492+ next unless $file -> indexed;
491493
492- next unless $file ;
493494 $file -> add_module( {
494495 name => $module ,
495496 version => $data -> {version },
Original file line number Diff line number Diff line change @@ -230,18 +230,14 @@ test 'modules in Packages-1.103' => sub {
230230 = map { ( $_ -> {path } => $_ -> {module } ) } @{ $self -> module_files };
231231
232232 foreach my $path ( sort keys %{ $self -> modules } ) {
233- my $desc = " File '$path ' has expected modules" ;
234- if ( my $got = delete $module_files {$path } ) {
235- my $got = [ map +{%$_ }, @$got ];
236- $_ -> {associated_pod } //= undef for @$got ;
233+ my $desc = " File '$path ' has expected modules" ;
234+ my $got_modules = delete $module_files {$path } || [];
235+ my $got = [ map +{%$_ }, @$got_modules ];
236+ $_ -> {associated_pod } //= undef for @$got ;
237237
238238 # We may need to sort modules by name, I'm not sure if order is reliable.
239- is_deeply $got , $self -> modules-> {$path }, $desc
240- or diag Test::More::explain($got );
241- }
242- else {
243- ok( 0, $desc );
244- }
239+ is_deeply $got , $self -> modules-> {$path }, $desc
240+ or diag Test::More::explain($got );
245241 }
246242
247243 is( scalar keys %module_files , 0, ' all module files tested' )
Original file line number Diff line number Diff line change @@ -28,14 +28,7 @@ test_release(
2828 indexed => true,
2929 associated_pod => undef ,
3030 } ],
31- ' lib/Dupe.pm' => [ {
32- name => ' Dupe' ,
33- version => ' 0.993' ,
34- version_numified => ' 0.993' ,
35- authorized => true,
36- indexed => false,
37- associated_pod => undef ,
38- } ],
31+ ' lib/Dupe.pm' => [],
3932 ' DupeX/Dupe.pm' => [
4033 {
4134 name => ' DupeX::Dupe' ,
You can’t perform that action at this time.
0 commit comments