From: dms Date: Thu, 8 Feb 2001 14:09:45 +0000 (+0000) Subject: we did not use flat args for forkers. found by asuffield. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=20dbe27f78028a82134908ccd3fd6f0333ddc602;p=infobot.git we did not use flat args for forkers. found by asuffield. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@363 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/CommandStubs.pl b/blootbot/src/CommandStubs.pl index 695139a..c942c9d 100644 --- a/blootbot/src/CommandStubs.pl +++ b/blootbot/src/CommandStubs.pl @@ -35,9 +35,9 @@ sub addCmdHook { sub parseCmdHook { my ($hashname, $line) = @_; $line =~ /^(\S+)( (.*))?$/; - my @args = split(' ', $3 || ''); - my $flatarg = $3; my $cmd = $1; # command name is whitespaceless. + my $flatarg = $3; + my @args = split(/\s+/, $flatarg || ''); my $done = 0; &shmFlush(); @@ -95,9 +95,12 @@ sub parseCmdHook { if (exists $hash{'Forker'}) { $hash{'Identifier'} .= "-" if ($hash{'Forker'} eq "NULL"); - ### FLAT_ARG / ARRAY option. + if (exists $hash{'FlatArg'} and $hash{'FlatArg'} == 0) { + &Forker($hash{'Identifier'}, sub { \&{$hash{'CODEREF'}}(@args) } ); + } else { + &Forker($hash{'Identifier'}, sub { \&{$hash{'CODEREF'}}($flatarg) } ); + } - &Forker($hash{'Identifier'}, sub { \&{$hash{'CODEREF'}}(@args) } ); } else { if (exists $hash{'Module'}) { &loadMyModule($myModules{ $hash{'Module'} });