The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Pod::Weaver::Role::AddTextToSection - Add text to a section


This document describes version 0.06 of Pod::Weaver::Role::AddTextToSection (from Perl distribution Pod-Weaver-Role-AddTextToSection), released on 2017-01-14.


 my $text = <<EOT;
 This module is made possible by L<Krating Daeng|>.

 A shout out to my man Punk The Man.

 Thanks also to:


 =item * my mom

 =item * my dog

 =item * my peeps



 $self->add_text_to_section($document, $text, 'THANKS');



$obj->add_text_to_section($document, $text, $section[, \%opts]) => bool

Add a string $text to a section named $section.

$text will be converted into a POD element tree first.

Section are POD paragraphs under a heading (=head1, =head2 and so on). Section name will be searched case-insensitively.

If section does not yet already exist: will create the section (if create option is true) or will die. Section will be created with =head1 heading at the bottom of the document (XXX is there a use-case where we need to add at the top and need to provide a create_top option? XXX is there a use-case where we need to create head2 and so on?).

If section already exists, will skip and do nothing (if ignore option is true, not unlike INSERT OR IGNORE in SQL) or will add text. Text will be added at the bottom the existing text, unless when top option is true in which case will text will be added at the top the existing text.

Will return a boolean status which is true when text is actually added to the section.


  • create => bool (default: 1)

    Whether to create section if it does not already exist in the document.

  • after_section => str|array

    When creating a section, attempt to put the new section after the specified section(s). This is evaluated before before_section.

  • before_section => str|array

    When creating a section, attempt to put the new section before the specified section(s).

  • ignore => bool (default: 0)

    If set to true, then if section already exist will skip adding the text.

  • top => bool (default: 0)

    If set to true, will add text at the top of existing text instead of at the bottom.


Please visit the project's homepage at


Source repository is at


Please report any bugs or feature requests on the bugtracker website

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.


perlancar <>


This software is copyright (c) 2017 by

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.