This small self-contained program, including a little pod at the end:

#!/usr/bin/env perl use strict; use warnings; use Pod::Usage; pod2usage(-exitstatus => 0, -verbose => 99, -sections => 'ACTIONS/back.*', -noperldoc => 1); __END__ =head1 ACTIONS Para for actions. =head2 backup I<pkg> B<please> dest Para for backup.

gives me this unexpected output, with the marked-up "pkg" and "please" text on the head2 line missing:

backup dest: + Para for backup.

I'm trying to use markup on a head2 line, and then select it with pod2usage's -section option. The marked-up text is omitted, though the regular head2 text comes out fine.

Perhaps this is beyond the scope of what pod2usage is intended to do, but I couldn't find anything either explicitly disallowing or allowing it in the Pod::Usage documentation, and the POD documentation does explicitly say that formatting codes are allowed on header lines.

Incidentally, the -noperldoc => 1 is there just to eliminate the possibility of interactions with pagers or the like. It doesn't actually change the behavior, so far as I can see.

This is only about the pod2usage() function. The output from the pod2text and pod2html utilities, for example, correctly includes the marked-up text (again, "pkg" and "please" in the above). (Well, The table of contents from the pod2html output just has the text without any actual markup ("pkg" rather than "<i>pkg</>"), but that seems fine.)

I tried enabling the use constant DEBUG => 7 in Pod/Simple/BlackBox.pm and could see that the markup got parsed and returned as nested lists (as expected). At what level the marked-up text gets elided, I could not discern without putting in lots more effort. So I thought I'd post here before going further.

This was on i686-linux with perl 5.20.1, compiled (with gcc 4.9.2) and installed from the original source. I tried a variety of older Perl versions, both distro-supplied and my compilations, with the same results (or, if old enough, -sections is not supported).

Thanks for any fixes, workarounds, or other clues. --karl

P.S. Just in case you're wondering why I want to do this in the first place: <i>...</i> seemed like the best way to specify metavariables in a synopsis, and I like to give a synopsis of subcommands as headings. That way, the pod2html output is nicer, since the synopses show up in the table of contents. We do this in the documentation for our so-called TeX Live Manager program. For instance, the real pod for our backup subcommand is this:

=head2 backup [--clean[=I<N>]] [--backupdir I<dir>] [--all | I<pkg>].. +.

The HTML output for the full tlmgr pod can be seen at http://tug.org/texlive/doc/tlmgr.html (seems I'm not allowed to include that as a live link), where the synopsis of the subcommands can be seen up front in the toc.


In reply to pod2usage() -sections omits marked-up text from =head lines? by karlberry

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.