This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Porting/sync-with-cpan: try to change "::" to "-" in module name
authorAaron Crane <arc@cpan.org>
Fri, 30 Dec 2016 15:26:37 +0000 (15:26 +0000)
committerAaron Crane <arc@cpan.org>
Fri, 30 Dec 2016 18:44:55 +0000 (18:44 +0000)
This is needed for cases like IO-Compress when the user asks for
"IO::Compress".

In addition, if we still can't find the module, be more explicit about what
the problem is.

Porting/sync-with-cpan

index 564b6af..498862d 100755 (executable)
@@ -229,11 +229,14 @@ my ($module)  = shift;
 
 my $info = $Modules{$module};
 if (!$info) {
-    # Maybe the user said "Test-Simple" instead of "Test::Simple". See if we
-    # can fix it up.
-    (my $guess = $module) =~ s/-/::/g;
-    $info = $Modules{$guess}
-        or die "Cannot find module $module";
+    # Maybe the user said "Test-Simple" instead of "Test::Simple", or
+    # "IO::Compress" instead of "IO-Compress". See if we can fix it up.
+    my $guess = $module;
+    s/-/::/g or s/::/-/g for $guess;
+    $info = $Modules{$guess} or die <<"EOF";
+Cannot find module $module.
+The available options are listed in the %Modules hash in Porting/Maintainers.pl
+EOF
     say "Guessing you meant $guess instead of $module";
     $module = $guess;
 }