[erlang-questions] How to autoload a module

Joe Armstrong erlang@REDACTED
Thu Nov 25 21:44:31 CET 2010


There is a special module called user_default which was designed to
extend the shell.
Any functions in user_default can be called from the shell without a
module prefix.

-module(user_default).

-export([get_args/0]).

get_args() ->
    io:format("get_args was called~n").

Compile this and make sure it is your path.

> erlc user_default.erl
 joe$ erl
Erlang R14A (erts-5.8) [source] [smp:2:2] [rq:2] [async-threads:0]
[hipe] [kernel-poll:false]

Eshell V5.8  (abort with ^G)
1> get_args().
get_args was called
ok

/Joe


2010/11/25 Gilberio Carmenates García <co7eb@REDACTED>:
> Hi all!
>
>
>
> I have a little problem , for example if I want to load a module made by me
> using the shell
>
> e.g.
>
>
>
> erl  -sname test
>
>
>
> What can I put to complete that line before making me able to do something
> like this
>
>
>
> Once in the Erlang shell
>
>
>
> get_args().
>
>
>
> Instead of
>
>
>
> myapp:get_args().
>
>
>
> NOTE: I don’t wanna use boot files.
>
>
>
> Best,
>
>
>
> Ivan.
>
>
>
>
>
> =======================================================================
> Este mensaje ha sido enviado mediante el servicio de correo electrónico que ofrece la Federación de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organización y su política informativa. La persona que envía este correo asume el compromiso de  usar el servicio a tales fines y cumplir con las regulaciones establecidas.
>


More information about the erlang-questions mailing list