Anonymous function and rpc

Jérôme Sautret jerome.sautret@REDACTED
Wed May 24 11:43:47 CEST 2006


Hello all,

Is it possible to pass an anonymous function as a parameter of a
function called by rpc ?
The strange thing is I can do it in the BEAM shell, but not in a module :

% erl -sname debug
Erlang (BEAM) emulator version 5.4.6 [source] [threads:0]

Eshell V5.4.6  (abort with ^G)
(debug@REDACTED)1> rpc:call(debug2@REDACTED, mnesia, transaction,
[fun() -> ok end]).
{atomic,ok}
(debug@REDACTED)2> mydebug:mydebug().
{aborted,{undef,[{#Fun<mydebug.0.39827269>,[]},
                {mnesia_tm,apply_fun,3},
                {mnesia_tm,execute_transaction,5},
                {rpc,'-handle_call/3-fun-0-',5}]}}
(debug@REDACTED)3> q().
ok
% cat mydebug.erl
-module(mydebug).
-export([mydebug/0]).

mydebug() ->
   rpc:call(debug2@REDACTED, mnesia, transaction, [fun() -> ok end]).

% EOF
%

Any hint welcome.
Thanks,
Jérôme.



More information about the erlang-questions mailing list