Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Should IO::YAML ignore leading comments?

by dynamo (Chaplain)
on Sep 18, 2007 at 19:17 UTC ( [id://639735]=note: print w/replies, xml ) Need Help??


in reply to Should IO::YAML ignore leading comments?

I don't think it's a bug. And it's not necessarily ignoring leading comments in that case - the "---" line is a document start indicator, and is optional. So you have an empty doc there with a comment, and then another doc w/ data. Try putting your comment below the "---"
- dyn
Update: I was wrong.

The leading comment should NOT start a new document, this IS a bug.
See the spec as it relates to comments. Also, see this example, where it says two documents rather than the four it would be if comments were their own documents.
Despite this, in the interests of pragmatism, if you don't want to fix IO::YAML or wait for the author to do so, I'd still recommend putting the comment below the start indicator.

Replies are listed 'Best First'.
Re^2: Should IO::YAML ignore leading comments?
by clinton (Priest) on Sep 19, 2007 at 11:02 UTC
    Why were you wrong? Your explanation was what I would have thought of. Can you explain why it isn't so?

    thanks

    Clint

      I'm not 100% sure I understand your question, but basically, I am wrong about the above example being two docs (the first one empty, aside from the comment) because the current (v1.1) YAML spec says so, and well, being the spec and all, it trumps my opinion.

      The second link from my updated comment (figure 2.7), and most especially it's caption "_two_ documents in a stream" says it better than I could if I were to try to rephrase.

      If comments could be their own documents, that caption would say "four documents in a stream, two of which are empty but have comments".

      Hope that helps, - d

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://639735]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found