A followup to my own followup (but not as a reply, which could drive the depth of the replies below the default level of visibility).

The preprocessor could take, as arguments, two patterns to identify the start and the end of the pod block. This would make it more general than something dependent on C conventions.

Update: and maybe another pattern to determine what should be deleted from the start of each line in the pod block, so we don't have to rely on white space.

Update #2: First approximation (missing way to set patterns):

#!/usr/bin/perl -w use strict; my $start = qr{^.*#\s*ifdef\s+pod}; my $stop = qr{^.*#\s*endif\s*/\*\s*pod\s*\*/}; my $trim = qr{^\s*}; my $verb = qr{^\s*=v\s}; my $show = 0; while ( my $line = <DATA> ) { if ( $line =~ $start ) { $show = 1; next; } if ( $line =~ $stop ) { $show = 0; next; } if ($show) { chomp($line); $line =~ s/$trim//; $line =~ s/$verb//; print $line, "\n"; } } __DATA__ This could be anything #ifdef pod =head2 title blah, blah,blah =v indent 1 #endif /* pod */ This could be anything, too

In reply to Re^4: Embedding pod in C by jpl
in thread Embedding pod in C by jpl

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.