Erlang for everyday use (1)

Posted by stoyan

After the last Osaka Erlang meeting , decided to start a column of articles for Erlang everyday use. Recently there is a big interest in Erlang, but the beginning is always difficult. Some push during the first steps usually helps. OK, on the topic:

Installation

I hear several time: “It’s take me 30 min to compile it…”, “The PLT compile takes … min…”, “On Windows it’s difficult…”. What are you doing guys?

CEAN 1.2 is online, with 200 packages. Binary packages are available for up to 17 platforms.

Just download the binaries for your platform and you are ready. There are two flavors:

  • “Production” – only .beam files, small size, ready for production use
  • “Developer”.beam files AND sources (.erl) – go with this for your development machine

Plus you get package management (install, uninstall, dependencies tracking) for free:

[~/cean]$ ./start.sh 
Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.5.4  (abort with ^G)
1> cean:installed().
["cean",
 "compiler",
 "debugger",
 ...
 "yaws"]
2> cean:install("gs").
+ gs md5=<<241,57,155,224,152,243,10,41,231,159,223,113,196,45,116,195>>
ok
3> cean:uninstall("snmp").
can not uninstall snmp. ["mnesia"] are dependent upon it.
ok

By default the installer and the archive both install everything in one directory. Usage is through the included start.sh shell script (not sure how is on Windows).

What to use it from other directories?

Easy, just a thin wrapper will fix this:
$ cat ~/bin/erl
#!/bin/sh

CEANDIR=/home/erl/cean
${CEANDIR}/start.sh -pa ${CEANDIR}/lib/*/ebin "$@" 

Missing erlc (compiler)?

Just add -compile to the arguments of the script above (some alias will do the job too):
$ erl -compile processes.erl

Need to_erl, run_erl

(for example for the yaws start/stop script)? Add the erts bin directory to your path:
$ cat .bash_profile
PATH=~/cean/erlang/erts-5.5.4/linux-x86/bin:"${PATH}" 

Happy erlanging. Hm, what to post about the next time? Some ideas:

  • project directories and “makefile”
  • deployment – inets, pico, yaws

Stay tuned…

Comments

Leave a response

  1. Jan WikholmJune 12, 2007 @ 03:41 PM

    This is much appreciated! as I am one of the newbies with Erlang, who just got their hands on the “Programming Erlang” (beta) PDF and I begin to see how the language itself works, this is the perfect continuation to that, since a repository of ready-made packages is what I need, so I don’t have to invent the wheel as a square every now and then ;)

    I haven’t had much time to look at CEAN but it seems to be similar to Ruby’s gems, which I am more than familiar with.

    RSS Feed subscribed

    Oh. p.s. Excellent blogging engine you are using ;)