OK, here's the answer.

In Perl 4, there was no POD. But there was a similar trick for wrapping the documentation up in your program. You would write documentation in troff code. (troff is the unix formatting program that is used to format the man pages.) Then you would embed the troff documentation after the __END__ marker for your program, and add some troff commands at the beginning of your program to tell troff to ignore the rest of the Perl code in between. When you ran your program with Perl, the troff commands would be ignored because they looked like string constants in void context.

The result is that you would have one file which would serve as input to Perl or to troff. If you fed it to Perl, it would run. If you fed it to troff (or to the man program, which is just nroff) you would get formatted documentation out the other side.

But when you ran the program, you wouldn't want to get a warning that the documentation strings were being uselessly used in void context, so strings that begin with "ds", "di", and "ig" were exempted from the warning. "di" diverts input into a nother macro, and "ig tells troff to ignore all the following text until it sees a certain character sequence; that's how troff was told to ignore the Perl code. "dr" doesn't appear to have been used.

The pink camel book contains a program called wrapman, which takes a Perl program and wraps it up with the right troff incantations, and appends a stub man page to it. To see an example of the result, look at the file eg/relink that is still in the Perl source distribution.

Astute readers may realize that arranging a file so that it is syntactically correct in two different languages at the same time is a common trick played by people who like to enter obfuscated code contests. It's probably no coincidence that Larry Wall was a repeat winner in the IOCCC.


In reply to Re: How to make warnings disappear by Dominus
in thread How to make warnings disappear by Dominus

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.