From 3284f879c364a2a7b6d9c1227b21c6ed29246d28 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 4 Apr 2020 12:08:14 +0300 Subject: 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. --- lib/App/Mangemanche.pm | 5 +++-- 1 file 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, $_]; -- cgit v1.2.1