[newbie] Erlangish way of Iterator pattern
Gaspar Chilingarov
nm@REDACTED
Tue Jan 25 15:20:26 CET 2005
Hello!
I'm beginning to program in erlang and hit the following problem.
in mainstream language i will do the following -- create Iterator class
to read data from socket or file
i.e. class with Open/GetNext functions. Open should just do all work for
preparing data source and GetNext will return lines of data or
EOF(freeing resources when reaching EOF).
what i have in erlang -- i have erlang process, which can accept data
messages and eof messages and do processing. another process hangs
around, waiting for TCP connection and feeding first process with data
read from TCP. in the same time i have shell script which runs once a
minute and feeds data from some file(or piped command line) to TCP port.
now i want to get rid of shell script, but i wish to have separate
module which will do this -- i.e. 1. running periodically external
command, 2. feeding to another process.
are there any idioms in Erlang for this or it should be implemented in
straight way -- i.e. just another process sitting there and doing it's
job -- file reading/parsing/feeding to another process ?
--
Gaspar Chilingarov
System Administrator
t +3749 419763
w www.web.am
e nm@REDACTED
More information about the erlang-questions
mailing list