# first expand out the entry to a command
($path, $fcmd) = search($main::localcmd, $cmd, "pl");
# first expand out the entry to a command
($path, $fcmd) = search($main::localcmd, $cmd, "pl");
- ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
+ ($path, $fcmd) = search($main::cmd, $cmd, "pl") unless $path && $fcmd;
Log('DXCommand', "$call disconnected");
$self->SUPER::disconnect;
Log('DXCommand', "$call disconnected");
$self->SUPER::disconnect;
if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
dbg("got dir: $curdir/$l\n") if isdbg('command');
$dirfn .= "$l/";
$curdir .= "/$l";
if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
dbg("got dir: $curdir/$l\n") if isdbg('command');
$dirfn .= "$l/";
$curdir .= "/$l";
- } else { # we are dealing with commands
- @lparts = split /\./, $l;
- next if $lparts[$#lparts] ne $suffix; # only look for .$suffix files
+ }
+ # only proceed if we find the directory asked for
+ return () unless $found;
+ } else {
+ foreach my $l (sort @ls) {
+ next if $l =~ /^\./;
+ next unless $l =~ /\.$suffix$/;
$dirfn = "" unless $dirfn;
$cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
$dirfn = "" unless $dirfn;
$cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');