Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

erlang - What is the easiest way for beginners to install a module?

I checked out rebar, but that seems way too complex. Maybe someone could post something that says, %Post your code here in the following rebar app:

%%%-------------------------------------------------------------------
%% @doc myapp public API
%% @end
%%%-------------------------------------------------------------------

-module('myapp_app').

-behaviour(application).

%% Application callbacks
-export([start/2
        ,stop/1]).

%%====================================================================
%% API
%%====================================================================

start(_StartType, _StartArgs) ->
    'myapp_sup':start_link().

%%--------------------------------------------------------------------
stop(_State) ->
    ok.

Is there some easier alternative for beginners?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You cannot escape having to learn your language's build system if you're going to create anything non-trivial. If you are familiar with GNU Make you can use erlang.mk instead of Rebar, but I believe Rebar3 is the most beginner-friendly.


To solve the specific problem of running someone's library code inside of the REPL, try the following with rebar3:

rebar3 new app

Ignore the source files that it creates for now. Edit rebar.config and add dependencies. Then, launch a REPL that has those dependencies loaded (along with any source files you've created in the src/ directory):

rebar3 shell


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...