[tpm] delimiting/reading YAML documents across sockets

Fulko Hew fulko.hew at gmail.com
Mon Jul 8 12:25:57 PDT 2013

Here's another entry for my 'yet to be composed' meeting
presentation entitled 'Things I've Stubbed My Toe On ...'

I'm trying to use YAML modules to send structures across
pipes from children to parent processes (or sockets).
Although the YAML docs talk about Dump() and Load()
I haven't been able to find (or figure out) an adequate
example of 'exchanging' the data, only encoding and decoding.

Although YAML talks about documents, and documents are delimited
by '---' and '...' respectively, the YAML.pm doesn't (apparently)
directly provide this kind of 'document' support.  I would have
expected a module to have provided a 'document wrapper' support.

Although I can add the wrapper manually during transmission...

Then when it comes to the receiving end... what am I expected
to do?  I don't think I can do a simple newline delimited read.
[What happens to newlines that may have been in the variables
I was YAML sending ?]   Do I need to sit in a loop doing
newline-reads, accumulating stuff, till I see a line that starts
with the '---' or '...' ?

And, can all variables in a single exchange be sent within
the same document (example?) or do I have to send them
as individual documents within some kind of 'document of
document' wrapper?  Surely this can't be as hard as it seems?

Suggestions, examples or references ?
[PS. The same questions would apply to anyone who suggests
 JSON as an alternative.]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20130708/a1145d38/attachment.html>

More information about the toronto-pm mailing list