[erlang-questions] Can't run my command line Erlang program

Andrew Pennebaker <>
Fri Nov 15 01:46:52 CET 2013


I'm switched to start/0 and using init:get_plain_arguments(), and using
-extra instead of --. It works now!

Source:

https://github.com/mcandre/ios7crypt/tree/master/erlang

Test:

$ make
erlc -Wall +debug_info ios7crypt.erl
erl -noshell -s ios7crypt -extra -e monkey
1104160b1c1712
erl -noshell -s ios7crypt -extra -d 020b0b55000316
monkey

Now that my code seems to work, I took a look with dialyzer for potential
trouble spots. I'm not sure what to make of the output.$ make lint

Dialyzer:

erlc -Wall +debug_info ios7crypt.erl
dialyzer *.beam --build_plt --quiet
dialyzer *.beam
  Checking whether the PLT /Users/andrew/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
ios7crypt.erl:60: The pattern 'true' can never match the type 'false'
...

In particular, I'm confused what dialyzer doesn't like about line 60.

59  FirstOne = case is_binary(FirstTemp) of
60    true -> binary_to_list(FirstTemp);
61    false -> FirstOneRaw
62  end,

Not sure what's wrong. I tried using `_` instead of `false`, but got the
same warning. Should I use an if/else instead of case?



On Thu, Nov 14, 2013 at 3:39 AM, Jachym Holecek <>wrote:

> # Andrew Pennebaker 2013-11-13:
> > I'm trying to get my command line Erlang program [...]
>
> Not sure it fits your use case, but escript might come in handy:
>
>   $ cat /tmp/foo
>   #!/home/jh/R16B01/bin/escript
>
>   main(Args) ->
>           io:format("~p~n", [Args]),
>           init:stop().
>
>   $ /tmp/foo hi there
>   ["hi","there"]
>
> See 'erl -man escript'.
>
> BR,
>         -- Jachym
>



-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131114/52ad400c/attachment.html>


More information about the erlang-questions mailing list