3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 05:49:27 +01:00

Interpreter: fix $0 in commands that use &{subs}

This commit is contained in:
Pragmatic Software 2023-03-23 08:56:58 -07:00
parent ca21999d5d
commit 05cf63e00c
2 changed files with 9 additions and 2 deletions

View File

@ -368,6 +368,13 @@ sub interpret {
# add it to the list of substituted commands
push @{$context->{subcmd}}, "$keyword $arguments";
# FIXME: quick-and-dirty hack to fix $0.
# Without this hack `pet &{echo dog}` will output `You echo
# the dog` instead of `You pet the dog`.
if (not defined $context->{root_keyword}) {
$context->{root_keyword} = $keyword;
}
# trim surrounding whitespace
$command =~ s/^\s+|\s+$//g;

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4632,
BUILD_DATE => "2023-03-19",
BUILD_REVISION => 4633,
BUILD_DATE => "2023-03-23",
};
sub initialize {}