[erlang-questions] Sending funs between nodes

Kirill Zaborski qrilka@REDACTED
Wed Aug 29 21:28:33 CEST 2007

I was trying to do the following:
1) a module on node X -

go() ->
P = spawn(fun() -> receive X -> X() end end),
register(rrr, P).
2) a module on node Y -

go() ->
{rrr, x@REDACTED}!fun() -> io:format("bar",[]) end.

LOKI is my hostname :)

So If I run test1:go() and then test2:go() on other node I get

=ERROR REPORT==== 29-Aug-2007::22:34:29 ===
Error in process <0.35.0> on node 'y@REDACTED' with exit value:

** exited: {undef,[{shell_default,fun_to_list,[#Fun<erl_eval.20.62269157>]},
                   {shell,eval_loop,3}]} **

It looks like fun needs code of the module where it was defined. Why is it
is there any way around this issue? Or I need the same beams on all the

Best regards,
Kirill Zaborski.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070829/ee586ac3/attachment.htm>

More information about the erlang-questions mailing list