[erlang-questions] Newbie question: is there something like a main() method in Erlang?
Sat Apr 28 07:11:43 CEST 2007
Harish Mallipeddi wrote:
> I just started learning Erlang. I'm using Joe Armstrong's old book
> (Concurrent programming in Erlang).
> Anyways I'm wondering if there's like a main() method in Erlang which
> will run automatically? Currently from the examples I've been coming
> across in the book and online, you've to create a new module and then go
> to the Erlang shell and do c('module_name') to compile/load the module.
> Is there a way to just say "erl module.beam" and have it invoke some
> method automatically much like how if __name__=="__main__" works in Python.
If your looking to run an erlang program from the unix command line
there's escript. If your talking about an embedded application take a
look at something like
http://wiki.trapexit.org/index.php/Building_An_OTP_Application or some
of the other articles on trapexit. I haven't had a chance to write a
release as yet. Most of the stuff I've been developing is through the
shell. Someone else on this list may have a better idea. One last
thought take a look at something like yaws to see how it's put together.
More information about the erlang-questions