[erlang-questions] how to dynamically create function to run in a different node

Dror Mein drormein@REDACTED
Thu Dec 25 11:55:46 CET 2014

Hi all,I want to send a function created dynamically in one node to a second node to be run there.
If I do this with erlang shell it works because the created function is compiled with erl_eval: (abe)1> A = fun() -> io:format(use, "sup", []) end.#Fun<erl_eval.20.12345678> (abe)2> B=fun test:hey/0.
#Fun<test.hey.0>(abe)3>{shell, bob} ! A.A(abe)4>{shell, bob} ! B.

(bob)1>register(shell, self()).true(bob)2>receive A -> A() end.supok(bob)3>receive B -> B() end.** exception error: undefined function test:hey/0
If I load the module to the second node it will work, but then I have to have all the parameters set. My preferred solution would be somehow to compile a function turning it into <erl_eval> in a module. Is it possible? will it work?
thank you all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141225/2af2570c/attachment.htm>

More information about the erlang-questions mailing list