Learning Erlang [duplicate]
Possible Duplicate:
What is the best way to learn Erlang?
I'm interested in learning Erlang; I'd appreciate suggestions on resources - books, websites, etc. - that can help me along. So far I've learned quite a bit 开发者_如何转开发from Learn you some Erlang. At this point I'm comfortable with the syntax and most of the (basic) concepts. As a practice project I was thinking of writting a server socket app that serves xml data when conected, unfortunately, I'm not sure where to start - i.e. what libraries to use and how to use them. Thanks.
gen_tcp is Erlang's interface to TCP/IP sockets. You can find many examples of how to use it in Erlang/OTP libraries or in open-source applications. For example, take a look at these http server and client libraries: https://github.com/mochi/MochiWeb, https://github.com/cmullaparthi/ibrowse
Handling XML in Erlang is more painful than it should be. JSON might be a little bit easier, if you have an option to use it instead of XML.
For XML, there's a standard Xmerl library which is a part of Erlang/OTP. I found that the least painful way to extract necessary pieces from XML is to use XPath (xmerl_xpath:string
). For XML generation, xmerl:export_simple
is the way to go.
I've also used Erlsom library. I has a (rather) simple XML parsing interface.
trapexit has an excellent article for building a tcp server with OTP.
精彩评论