How do you install a module in erlang?

廉价感情. 提交于 2020-01-01 02:31:33

问题


I am new to Erlang and would like to to know how to install third party modules for use in my web application.

Where do you place this files and what sort of commands do you execute?


回答1:


If you wish to install 3rd party libs, like Mochiweb, system wide it's best to set it up under the $ERL_LIBS environment variable. I write a bit about it here and give examples of installing common tools here. It is probably best not to put anything inside Erlang's own code library(/usr/lib/erlang/lib) but the path inside $ERL_LIBS behaves the same way. That is that it adds $ERL_LIBS/**/ebin to the codepath.

However you should really only do things like this while learning the system. To make stable software it's best to include with your app all the dependent code. Also see the answer here for some insight on to why you may wish for this.




回答2:


In my distributive (Arch Linux) this place is /usr/lib/erlang/lib. Of course, you need to build module (make).

Also you can define path for your modules:

demas@arch ~ $ cat .erlang
code:add_pathz("/media/pt_lin/materials/erlang").


来源:https://stackoverflow.com/questions/2896336/how-do-you-install-a-module-in-erlang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!