summaryrefslogtreecommitdiffabout
path: root/lib
authorSergey Poznyakoff <gray@gnu.org>2020-04-04 09:08:14 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2020-04-04 09:08:14 (GMT)
commit3284f879c364a2a7b6d9c1227b21c6ed29246d28 (patch) (unidiff)
tree78f819aee72c5f06e8cb24cc58dd80c4b7852201 /lib
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.
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-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 {
129 foreach my $mod (sort 129 foreach my $mod (sort
130 map { 130 map {
131 my $name = basename($_); 131 my $name = basename($_);
132 if (exists($INC{File::Spec->catfile(@classpath,$name)})) { 132 my $filename = File::Spec->catfile(@classpath,$name);
133 if (exists($INC{$filename})) {
133 () 134 ()
134 } else { 135 } else {
135 eval { 136 eval {
136 require $_; 137 require $filename;
137 }; 138 };
138 $name =~ s/\.pm$//; 139 $name =~ s/\.pm$//;
139 $@ ? () : [$name, $_]; 140 $@ ? () : [$name, $_];

Return to:

Send suggestions and report system problems to the System administrator.