[erlang-questions] Copy function from one Module to another

Fred Hebert <>
Tue Aug 14 18:09:38 CEST 2012


Why do you want to do this, instead of, for example, just sending the 
module to the other node?

{Mod, Bin, File} = code:get_object_code(Mod),
rpc:call(Node, code, load_binary, [Mod, File, Bin]).

or alternatively use rpc:multicall(Nodes) for many nodes and doing the same.

On 12-08-14 11:15 AM, Tyron Zerafa wrote:
>
> Hey Jesse
>     I need something stronger than just import. I need to put a bunch 
> of functions from different modules into a single one and transfer 
> this to a remote node. Then I want to be able to use these functions 
> from the remote node.
> If I simply use import, I will not be able to use them on the remote 
> node without explicitly transferring all the modules to which the 
> functions belong to.
>
>
> On Tue, Aug 14, 2012 at 5:10 PM, Jesse Gumm < 
> <mailto:>> wrote:
>
>     That sounds like you're looking for
>
>     -import(Module, Functions).
>
>     http://www.erlang.org/doc/reference_manual/modules.html
>
>     --
>     Jesse Gumm
>     Owner, Sigma Star Systems
>     414.940.4866 <tel:414.940.4866> || sigma-star.com
>     <http://sigma-star.com> || @jessegumm
>
>     On Aug 14, 2012 9:56 AM, "Tyron Zerafa" <
>     <mailto:>> wrote:
>
>         Hey all,
>             Is there any mechanism in Erlang which I can use to copy
>         functions from one module to another? So, if I have module *A*
>         containing functions *a*, *b* and *c*, is there any way in
>         which I can copy *a* to module B?
>
>         Thanks
>         Tyron
>
>
>         _______________________________________________
>         erlang-questions mailing list
>          <mailto:>
>         http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
>
> -- 
> Best Regards,
> Tyron Zerafa
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120814/dfefa02f/attachment.html>


More information about the erlang-questions mailing list