X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCommandmode.pm;h=1c54424e0744e8457700fbc77634f74cac072445;hb=59f80532f10bf3101b954ed30069f55b95476984;hp=0f802d89f6396a8fd031ea2323a8d41666c3131c;hpb=8195bc13ac14b8fbf13d804186680653b5fd8564;p=spider.git diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 0f802d89..1c54424e 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -199,20 +199,25 @@ sub run_cmd ($path, $fcmd) = search($main::localcmd, $cmd, "pl"); ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd; - dbg('command', "path: $cmd cmd: $fcmd"); + if ($path && $cmd) { + dbg('command', "path: $cmd cmd: $fcmd"); - my $package = find_cmd_name($path, $fcmd); - @ans = (0) if !$package ; - - if ($package) { - dbg('command', "package: $package"); + my $package = find_cmd_name($path, $fcmd); + @ans = (0) if !$package ; - my $c = qq{ \@ans = $package(\$self, \$args) }; - dbg('eval', "cluster cmd = $c\n"); - eval $c; - if ($@) { - @ans = (0, "Syserr: Eval err cached $package\n$@"); + if ($package) { + dbg('command', "package: $package"); + + my $c = qq{ \@ans = $package(\$self, \$args) }; + dbg('eval', "cluster cmd = $c\n"); + eval $c; + if ($@) { + @ans = (0, "Syserr: Eval err cached $package\n$@"); + } } + } else { + dbg('command', "cmd: $cmd not found"); + @ans = (0); } } } @@ -467,12 +472,12 @@ sub find_cmd_name { # return if we can't find it $errstr = undef; - if (undef $mtime) { + unless (defined $mtime) { $errstr = DXM::msg('e1'); return undef; } - if(defined $Cache{$package}{mtime} && $Cache{$package}{mtime } <= $mtime) { + if(defined $Cache{$package}->{mtime} && $Cache{$package}->{mtime } <= $mtime) { #we have compiled this subroutine already, #it has not been updated on disk, nothing left to do #print STDERR "already compiled $package->handler\n"; @@ -510,7 +515,7 @@ sub find_cmd_name { delete_package($package); } else { #cache it unless we're cleaning out each time - $Cache{$package}{mtime} = $mtime; + $Cache{$package}->{'mtime'} = $mtime; } }