]> git.donarmstrong.com Git - infobot.git/commitdiff
we did not use flat args for forkers. found by asuffield.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 8 Feb 2001 14:09:45 +0000 (14:09 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 8 Feb 2001 14:09:45 +0000 (14:09 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@363 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl

index 695139a10e057b26a35f88ee5a4a74a97568e651..c942c9dd8687246351d4aba983476f2011964d9c 100644 (file)
@@ -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'} });