Erlang Mailing Lists

Author Message

<  Erlang bugs mailing list  ~  supervisor doesn't like abstract modules

mscandar at cisco.com
Posted: Fri Apr 08, 2005 2:21 pm Reply with quote
Guest
Starting a child using a module instance as the module fails:

** exited: {{nocatch,{error,{invalid_mfa,
{{foo,bar,baz},
start_link,
[one,two,three]}}}}

Turns out there are some checks in supervisor.erl that expect a module to be an atom:

validFunc({M, F, A}) when atom(M), atom(F), list(A) -> true;
validFunc(Func) -> throw({invalid_mfa, Func}).


and

validMods(dynamic) -> true;
validMods(Mods) when list(Mods) ->
lists:foreach(fun(Mod) ->
if
atom(Mod) -> ok;
true -> throw({invalid_module, Mod})
end
end,
Mods);
validMods(Mods) -> throw({invalid_modules, Mods}).


I changed them to the following and all is well (so far):

validMods(dynamic) -> true;
validMods(Mods) when list(Mods) -> true;
validMods(Mods) -> throw({invalid_modules, Mods}).

validFunc({M, F, A}) when atom(F), list(A) -> true;
validFunc(Func) -> throw({invalid_mfa, Func}).


Mark.


Post generated using Mail2Forum (http://m2f.sourceforge.net)

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum