in reply to Interpolate Perl variables in POD

POD is not processed by the Perl interpreter in a fashion where interpolation makes sense (the interpreter parses POD just enough to ignore it).

Programs that process POD do not parse Perl (except enough to ignore it) so don't have values for Perl variables.


Perl reduces RSI - it saves typing

Replies are listed 'Best First'.
Re^2: Interpolate Perl variables in POD
by repellent (Priest) on Oct 01, 2008 at 01:04 UTC
    OK. But could there be a way to instruct the POD modules with a directive to substitute when it sees X<subst:keyword123> in POD? Maybe up front:
    use Pod::Subst qw(keyword123 replacement456)

    so that pod2usage() knows what to do. No Perl parsing need be involved.

    Thanks for the replies!

      You could post process the output from pod2usage() to do the substitutions. It would be smart to use a form of markup that is unlikely to be changed by the pod2usage() processing.

      Alternatively, you could preprocess the input to pod2usage() with the same caveat.


      Perl reduces RSI - it saves typing
        Ahhh. How would I post-process pod2usage() output before, say, it gets put out as a man page?