[erlang-questions] Why we need a -module() attribute?

Richard A. O'Keefe <>
Wed Feb 24 00:50:48 CET 2016



On 24/02/16 8:53 am, Kenneth Lakin wrote:
 > It doesn't seem to be the case. This works just fine for me with 
Erlang 18:
> $ ls
> $ mkdir -p dir/with/parents
> $ echo "-module (test).
>> -compile (export_all).
>>
>> run() -> ok." > dir/with/parents/test.erl
> $ erlc dir/with/parents/test.erl
> $ ls
> dir  test.beam
> $
There is an important difference.  The OP wanted the equivalent of
   -module(dir_with_parents_test).  Try it and you get
m% erlc dir/with/parents/test.erl
/home/cshome/o/ok/erlang.d/test.beam: Module name 
'dir_with_parents_test' does not match file name 'test'



>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list