[erlang-questions] Different behavior between erl and escript when the string module is used for unicode strings

Kawatake Chiharu ckawatak@REDACTED
Fri May 1 15:05:04 CEST 2009


Oh, I see. I did not know that. It's been about two weeks since I started
learning Erlang. Forgive me that I asked a silly question.

I feel embarrassed a bit. But I was able to learn more about it, anyway.

Thank you very much !

Chiharu


2009/5/1 Per Melin <per.melin@REDACTED>

> Kawatake Chiharu:
> > I found that erl and escript behaved differently when the string module
> was
> > used for unicode strings.
> >
> > Attached are what I tried to run with erl and escript. I also copied the
> > code at the bottom of this e-mail.
> >
> > When I did
> >
> > %> escript test.erl
> >
> > This works fine.
> >
> > However, when I used erl to run it, I got an error as follows.
> >
> > ------------------
> > %> erlc test.erl
> > %> erl -noshell -s test main -s init stop
> > {"init terminating in
> > do_boot",{undef,[{test,main,[]},{init,start_it,1},{init,start_em,1}]}}
>
> The error {undef,[{test,main,[]}, ...]} actually tells you what the
> problem is; there is no function 'main' in the module 'test' with
> arity zero (i.e. test:main/0).
>
> You can either start your program like this:
>
> erl -noshell -s test main "" -s init stop
>
> ...or add this to your code:
>
> main() -> main([]).
>
> ...and it should work.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090501/ca855e1c/attachment.htm>


More information about the erlang-questions mailing list