Search code examples
listperlauto-incrementperl-pod

Auto-increment integers for POD items


Would anyone know of a way to dynamically increment an integer for item titles? This is mainly to avoid having to change every step number in the event that a new step would need to be added/removed somewhere in the middle of a ton of steps. Below is a small three-step procedure to give you a rough idea of the template structure:

=step_wash 1. Wash

<p>Add washing steps here</p>

=cut

# Throw some perl code here to wash stuff

=step_dry 2. Dry

<p>Add drying steps here</p>

=cut

# Throw some perl code here to dry things

=step_fold 3. Fold

<p>Add folding steps here</p>

=cut

# Fold all of the things Perl!

Disregarding the item names and structure of this, the goal is to try and eliminate the use of statically numbering the title of each item. I am wondering if there is a possible way to generate an integer that increments; pretty much like replacing 1, 2, 3, etc with something like { print $i++ } instead.. but in POD.


Solution

  • POD is pretty Plain and doesn't do that sort of thing.

    An extension of POD called PseudoPod in theory does (see https://metacpan.org/pod/distribution/Pod-PseudoPod/lib/Pod/PseudoPod/Tutorial.pod#Lists) but when I tried it it gave an error.