mel里,当要eval("client()"),并且要传递stirngarray参数给函数client()时,正确的写法应该是:
global proc intermediator_good(string $array[]) { print(">intermediator(): ["+stringArrayToString($array, ",")+"], size="+size($array)+"\n"); if( size($array) == 0 ){ $cmd = "client({})"; }else{ $cmd = "client({\""+stringArrayToString($array,"\", \"")+"\"})"; } eval $cmd; }
要命的是,如果误写成:
global proc intermediator(string $array[]) { print(">intermediator(): ["+stringArrayToString($array, ",")+"], size="+size($array)+"\n"); $cmd = "client({\""+stringArrayToString($array,"\", \"")+"\"}) \n"; eval $cmd; }
在client()里:
global proc client(string $array[]) { print(">client(): ["+stringArrayToString($array, ",")+"]\n"); }
对于$array={""}和$array={}两种情况,print出来的信息是一样的(都是[])。调试的时候会被误导
转载请注明出处