The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

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

SYNOPSIS

 my $text = <<EOT;
 This module is made possible by L<Krating Daeng|http://www.kratingdaeng.co.id>.

 A shout out to my man Punk The Man.

 Thanks also to:

 =over

 =item * my mom

 =item * my dog

 =item * my peeps

 =back

 EOT

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

DESCRIPTION

METHODS

$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.

Options:

  • 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.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Pod-Weaver-Role-AddTextToSection.

SOURCE

Source repository is at https://github.com/perlancar/perl-Pod-Weaver-Role-AddTextToSection.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Pod-Weaver-Role-AddTextToSection

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.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by perlancar@cpan.org.

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