and the new head1 will appear at the end of the POD. However, I don't think it will be easy to add a a head1 section in the middle of the document (in case you want your sections to follow a uniform ordering). In that case, something like this might work for you:use Pod::POM; my $parser = Pod::POM->new(); my $pom = $parser->parse_file(...); my $h1 = $pom->add($parser, 'head1', 'This is a new head1');
Of course, this code silently discards sections that are not listed in @SECTIONS which is probably not what you want to do, but it at least is a start.my @SECTIONS = qw(name synopsis ...); my $pom = $parser->parse_file(...); my %found; for my $h1 ($pom->head1()) { $found{lc($h1->title)} = $h1; } for my $title (@SECTIONS) { my $h1; if ($h1 = $found{$title}) { print $h1; } else { print "=head1 ", uc($title), "\n\n"; } }
In reply to Re: check pod and insert missing sections
by pc88mxer
in thread check pod and insert missing sections
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |