[erlang-questions] I need a little newcomer help with basic STDIN\OUT code.

Eliezer Croitoru eliezer@REDACTED
Fri Sep 12 17:16:24 CEST 2014


Thanks Daniel,

I have tried to write a tiny proxy but in ruby and I did managed to 
write something but not as "concurrent" as I want.

I am unable to understand what each step does and can I add functionality.

I will try a basic tutorial to understand it first.

Thanks,
Eliezer

On 09/11/2014 09:41 PM, Daniel Goertzen wrote:
> The program below will read and then write one line at a time; hopefully
> it will help you get started.  Keep in mind that the task you describe
> isn't going to touch on concurrency or any of the other great parts of
> Erlang.  Try writing a little proxy server, then you will have fun. :)
>
>
> #!/usr/bin/env escript
>
> main(_Params) ->
> handle().
>
> handle() ->
> handle(io:get_line([])).
>
> handle(eof) ->
> halt(0);
>
> handle(Data) ->
> io:format("~s", [Data]),
> handle().
>
>
> On Thu, Sep 11, 2014 at 11:07 AM, Eliezer Croitoru <eliezer@REDACTED
> <mailto:eliezer@REDACTED>> wrote:
>
>     Hello,
>
>     My name is Eliezer and I have never used erlang before.
>     I am writing couple helpers for squid proxy server as a practice task.
>     I understood that erlang can provide concurrency options and was
>     curios about writing a small acl helper using it.
>     I have written example helpers in python, ruby, perl and couple
>     other languages and I want to write one in erlang too.
>
>     Since I am not familiar with the syntax I would like to get a
>     recommendation about a brief tutorial that can help me get this
>     specific task done.
>     The program task is:
>     read each line from STDIN and response accordingly to STDOUT by a
>     procedure\function\method.
>
>     In ruby, perl and python I have a method to fetch only one line from
>     STDIN which allows me to run a couple things on this line only while
>     the STDIN buffer receives more content.
>
>     I would like to do the same using erlang.
>
>     Any help will be appreciated.
>
>     Thanks,
>     Eliezer
>     _________________________________________________
>     erlang-questions mailing list
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/__listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
>
>




More information about the erlang-questions mailing list