aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-04-04 12:08:14 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-04-04 12:08:14 +0300
commit3284f879c364a2a7b6d9c1227b21c6ed29246d28 (patch)
tree78f819aee72c5f06e8cb24cc58dd80c4b7852201
parent0b57289838dd536d6f98696e16a06c3663535b8e (diff)
downloadmangemanche-3284f879c364a2a7b6d9c1227b21c6ed29246d28.tar.gz
mangemanche-3284f879c364a2a7b6d9c1227b21c6ed29246d28.tar.bz2
Don't list duplicate commands
* lib/App/Mangemanche.pm (list_commands): Load script by its relative name so its duplicates can be found in %INC.
-rw-r--r--lib/App/Mangemanche.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/App/Mangemanche.pm b/lib/App/Mangemanche.pm
index d0992f2..228f8fc 100644
--- a/lib/App/Mangemanche.pm
+++ b/lib/App/Mangemanche.pm
@@ -129,11 +129,12 @@ sub list_commands {
foreach my $mod (sort
map {
my $name = basename($_);
- if (exists($INC{File::Spec->catfile(@classpath,$name)})) {
+ my $filename = File::Spec->catfile(@classpath,$name);
+ if (exists($INC{$filename})) {
()
} else {
eval {
- require $_;
+ require $filename;
};
$name =~ s/\.pm$//;
$@ ? () : [$name, $_];

Return to:

Send suggestions and report system problems to the System administrator.