Erlang for everyday use (1)

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
4>

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...