`
xumingyong
  • 浏览: 176395 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

erl_call erlang cnode 功能强大

阅读更多

otp_src_R11B-5\lib\erl_interface\src\prog\erl_call.c 是个不错的工具, 就是ei的前端能够通过cnode给erlang的后端发各种请求。


  where: -a  apply(Mod,Fun,Args) (e.g -a 'erlang length [[a,b,c]]'
         -c  cookie string; by default read from ~/.erlang.cookie
         -d  direct Erlang output to ~/.erl_call.out.<nodename>
         -e  evaluate contents of standard input (e.g echo "X=1,Y=2,{X,Y}."|erl_call -e ...)
         -h  specify a name for the erl_call client node
         -m  read and compile Erlang module from stdin
         -n  name of Erlang node, same as -name
         -name  name of Erlang node, expanded to a fully qualified
         -sname name of Erlang node, short form will be used
         -q  halt the Erlang node (overrides the -s switch)
         -r  use a random name for the erl_call client node
         -s  start a new Erlang node if necessary
         -v  verbose mode, i.e print some information on stderr
         -x  use specified erl start script, default is erl


使用方法 :

1.   erl -name xx@192.168.0.98 启动后端

2.  export EI_TRACELEVEL=6

    i.    erl_call -v -d -n xx@erl98.3322.org -m  模块方式 ( -v -d 调试和verbose模式)
    如:
          -module(a).
   
   CTRL+D

    II.  erl_call -v -d -n xx@erl98.3322.org -e 表达式方式
       1+2.
    CTRL+D

    III.   erl_call -v -d -n xx@erl98.3322.org -a 'erlang length [[a,b,c]]'

    这2中都是从stdin读 直到你按下CTRL+D, 然后你就可以看到结果。

这只程序内存有泄漏
*    Note: We don't free any memory at all since we only
 *    live for a short while.  
而且 erl_call.c有bug  812行 free(mbuf);            /* Allocated in read_stdin() */ 
注释掉这行就可以了 

这个程序默认是不安装带标准发布目录去的。

从这个程序 我们可以知道cnode 能作的事情受限于你的想像力。

注:
ping erl98.3322.org
PING erl98.3322.org (192.168.0.98) 56(84) bytes of data.
由于erl_call程序有点小问题  -n xx@erl98.3322.org 最好用域名 否者erl_call就抓狂了。</nodename>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics