添加路径到Erlang搜索路径? [英] Add Path to Erlang Search Path?
问题描述
sudo erl -pa ebin
然后在提示符下:
test_jsonrpc:start_httpd 。
返回
ok
我用http://:5671进行了测试,并获得了成功的消息。
然而,当我尝试运行rabbitmq-http2时,我发现自述文件所说的错误是由rfc4627的代码不在erlang搜索路径上引起的。我该怎么把它放在路上我在Dave Thomas博客上看到一些建议将路径放在文件中的东西:
〜/ .erlang
这似乎不适合我(也许我做错了?)。
代码模块您是如何操纵应用程序中的路径。
您在启动Erlang shell时使用的标志-pa实际上是指该模块中的一个功能:
add_patha(Dir) - >真| {错误,什么}
您的主目录中的.erlang文件正确 - 正在运行在shell的启动时间,您可以添加方便的路径。
对于一个应用程序,您可以使用一个批处理文件来启动shell,如下所示: / p>
erl -pa ./ebin ../../lib/some/path/ebin
描述了erl的标志行为这里。
对于更复杂的路径管理,您需要熟悉如何 OTP发布管理已完成(但我怀疑你还有一段时间)。
I recently installed Erlang RFC4627 (JSON-RPC) with the debian package. I ran the test server using:
sudo erl -pa ebin
and then at the prompt:
test_jsonrpc:start_httpd().
returned
ok
I tested with http://:5671/ and got the success messages.
When I try to run rabbitmq-http2 however, I get the errors that the readme says are caused by rfc4627's code not being on the erlang search path. How do I put it on the path. I saw something on Dave Thomas's blog which suggested putting the path in the file:
~/.erlang
This didn't seem to work for me (maybe I did it wrong?).
The code module is how you manipulate the path within an application.
The flags -pa that you used in starting the Erlang shell actually refer to a function in this module:
add_patha(Dir) -> true | {error, What}
You are right about the .erlang file in your home directory - it is run at start-up time of the shell and you can add in handy paths.
For an application you can start the shell with a batch file that calls something like this:
erl -pa ./ebin ../../lib/some/path/ebin
The flags behaviour of erl is described here.
For more sophisticated path management you need to get familiar with how OTP release management is done (but I suspect that is a while away for you yet).
这篇关于添加路径到Erlang搜索路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!