<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Personally, I would suggest JSON, or even XML. YAML is fairly complex (it's advantage is human readability, not performance), and I'd suggest too complex, for network data. JSON, especially with JSON::XS, is fast, east, and handles newlines fine, apart from the packet-detection issue. </div><div><br></div><div>I'd agree that separating packetizing from encoding is ideal, but if you don't want to do that, you could try a streaming parser, e.g., JSON::Streaming::Reader. For sending, you can then just dump the data out. For receiving, in theory this gives you an event-based API which might be a more natural fit. XML uses technique much more -- it's the basis for XMPP for example. I use streaming XML a lot for handling very large, even continuous, data, and it's not really too bad, although it does push some of the encoding/decoding back to you. </div><div><br></div><div>Using indentation IMO makes the point of a streaming parser very dubious, which is another reason if you want to do streaming event-based reading to use either JSON, or even XML::Stream for reading and XML::Writer for sending. Personally, I doubt if there is ever going to be a safe application for streaming YAML. </div><div><br></div><div>All the best</div><div>Stuart</div><br><div><div>On 2013-07-08, at 3:25 PM, Fulko Hew wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">[PS. The same questions would apply to anyone who suggests<br> JSON as an alternative.]<br></span></span></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><p style="font-weight: normal; font-family: Arial, sans-serif; font-size: 8pt; margin-bottom: 0px; ">--</p><div style="font-weight: normal; font-family: Verdana, sans-serif; font-size: 10pt; color: rgb(57, 121, 59); margin-top: 0px; margin-bottom: 0px; "><b>Stuart Watt</b></div><p style="font-weight: normal; font-family: Verdana, sans-serif; font-size: 8pt; margin-top: 0px; "><a href="mailto:stuart@morungos.com">stuart@morungos.com</a> / <span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><a href="http://twitter.com/morungos">twitter.com/morungos</a></span></p></div></div></span></span>
</div>
<br></body></html>