1.在erlang shell中編譯執行
1 -module(hello).2 -export([start/0]).
34 start() ->
5 io:format("
hello world~n
").
view source
print?
erl
erlang r14b03 (erts-5.8.4) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
eshell v5.8.4 (abort with ^g)
1> c(hello).
2> hello:
module_info/0 module_info/1 start/0
2> hello:start().
hello world
ok
3>
2 在命令列提示符下編譯執行
view source
print?
erlc hello.erl
erl -noshell -s hello start -s init stop
快速指令碼
view source
print?
erl -
eval
'io:format("memory:~p~n",[erlang:memory(total)]).'
-noshell -s init stop
3 當做escript指令碼執行
1 #!/usr/bin/escript23 main(_) ->
4 io:format("
hello world~n
").
view source
print?
chmod
+x hello
./hello
Erlang模組與Erlang程式的執行方法
一 模組與程式檔案 erlang是一種函式式程式語言,當我們要完成乙個專案時,總不可能把所有的函式都定義在乙個程式檔案中,為了開發和維護方便,通常按邏輯功能劃分將其分別分散在多個程式檔案中。每個erlang程式檔案就是乙個模組,檔名的副檔名部分為.erl,模組的名稱必須與檔名稱中的主檔名完全相同 不...
PHP的幾種執行方式
前四種是提供給web伺服器來處理php 檔案,其中模組載入的方式其實是最快的的,但fastcgi配合nginx web服務是目前的主流,下面主要配合apache做說明。以模組載入的方式執行,其實就是將php整合到web伺服器,以同乙個程序執行。此執行模式在使用apache伺服器經常使用,通重載入模組...
(一)執行python的幾種方式
源 位元組碼 執行時 m.py m.pyc pvm pvm是python虛擬機器,用於解釋編譯得到的 使用互動命令執行python 在linux shell 下輸入python 2 輸入 print hello wolrd ctrl d退出 執行模組檔案 編輯script.py 檔案如下 frist...