Skip to content

Instantly share code, notes, and snippets.

@alexeyr
Created October 30, 2010 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexeyr/655324 to your computer and use it in GitHub Desktop.
Save alexeyr/655324 to your computer and use it in GitHub Desktop.
-module(moddeps).
-compile(export_all).
write_to(Filename) ->
xref:start(s),
xref:add_directory(s, "ebin"),
{ok, Calls} = xref:q(s, "XC"),
Mods = [{From, To} || {{From,_,_}, {To,_,_}} <- Calls],
A2L = fun atom_to_list/1,
file:write_file(Filename,
["graph G { \n"
, [[$\t, A2L(From), " -- ", A2L(To), " ; ", $\n]
|| {From, To} <- Mods]
, " }\n"]).
@alexeyr
Copy link
Author

alexeyr commented Oct 30, 2010

Since second argument of write_file is iodata(), this should work as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment