[erlang-questions] I need to call unexported functions from the erlang shell

Scott Lystig Fritchie fritchie@REDACTED
Fri Jun 15 18:50:05 CEST 2007


>>>>> "kw" == =?ISO-8859-1?Q?Claes Wikstr=F6m?= <ISO-8859-1> writes:

kw> I sympathize with Luke here. Debugging live systems, being able to
kw> call non exported functions from the shell is often ... well
kw> necessary.

Now that I've had an Erlang app running in someone else's data center,
I have also run into that situation, and have really wished I could
call non-exported functions.

Would it be any less icky to create a new BIF to work around the
problem?

    erlang:apply(Function::atom(), Args::list(term()))

... where Function must be in the caller's module and thus can act
like any function in a module calling any other function in that
module?  Then each source module would have added (via -include() or
whatever) one more exported function:

    trap_door(Function, Args) ->
        erlang:apply(Function, Args).

I see that Luke keeps mumbling something about the R9C-0 release.
Adding such a BIF to VMs in the field could be, er, an interesting
trick.  :-)

-Scott



More information about the erlang-questions mailing list