From 6832157d992c2e3afd1bf7c331d040b06371155a Mon Sep 17 00:00:00 2001 From: djk Date: Tue, 10 Nov 1998 21:59:07 +0000 Subject: [PATCH] made non-existant commands return an error --- perl/DXCommandmode.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 5348212d..a0cdbb48 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -124,7 +124,7 @@ sub normal ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd; my $package = find_cmd_name($path, $fcmd); - @ans = (0, "Syserr: compile err on $package\n$@$errstr") if !$package ; + @ans = (0) if !$package ; if ($package) { my $c = qq{ \@ans = $package(\$self, \$args) }; @@ -145,7 +145,7 @@ sub normal } else { shift @ans; if (@ans > 0) { - $self->send($self->msg('e2', @ans)); + $self->send($self->msg('e2'), @ans); } else { $self->send($self->msg('e1')); } @@ -394,6 +394,7 @@ sub find_cmd_name { my $fh = new FileHandle; if (!open $fh, $filename) { $errstr = "Syserr: can't open '$filename' $!"; + return undef; }; local $/ = undef; my $sub = <$fh>; @@ -424,7 +425,6 @@ sub find_cmd_name { print "\$\@ = $@"; $errstr = $@; delete_package($package); - $package = undef; } else { #cache it unless we're cleaning out each time $Cache{$package}{mtime} = $mtime; @@ -433,6 +433,7 @@ sub find_cmd_name { #print Devel::Symdump->rnew($package)->as_string, $/; $package = "DXCommandmode::$package" if $package; + $package = undef if $errstr; return $package; } -- 2.43.0