I asked because I couldn't think if a way to do it and it seems generally useful to be able to use interesting values of undef (eg. Perl6 is to support this for exceptions and potentially other things).

I can solve the problem at hand by other means, so my question is not seeking a specific solution but a general technique, and knowledge about what is possible in Perl 5.

Since you are curious about the context, I have an application which uses Storable for persistence and undef is used to represent "no answer". This works nicely for the core engine. I'm now working on a tool chain to convert a this data into various presentation formats, a few of which would like to distinguish between existant/nonexistant undefs and present them differently (the distinction being "no answer"/"no answer, never saw the question"). The distinction is more in the minds of the users than anywhere else, most of the utilities will not make this distinction and shouldn't be troubled by it. My current solution is to maintain the flags in a separate structure in parallel to the main data stream.

My original question mentioned YAML because the data stream pipeline uses IO::YAML pass data beween utilities.

If you have other suggestions, they're welcome,

Brad


In reply to Re^2: Special undefs with attributes by bsb
in thread Special undefs with attributes by bsb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.