manveru / CouchRB

Ruby implementation of CouchDB, mostly experimental

CouchRB / term_to_binary
100644 21 lines (18 sloc) 0.396 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname term_to_binary -mnesia debug verbose
main([String]) ->
  try
    Term = eval(String),
    io:format("Binary ~p\n", [Bin]),
    Term = term_to_binary(Bin),
    io:format("Binary ~p = ~p\n", [Bin,Term])
  catch
    _:_ ->
      usage()
  end;
 
main(_) ->
  usage().
 
usage() ->
  io:format("usage: term_to_binary term\n"),
  halt(1).