NAME

Dist::Zilla::Plugin::InsertBlock - Insert a block of text from another file

VERSION

This document describes version 0.102 of Dist::Zilla::Plugin::InsertBlock (from Perl distribution Dist-Zilla-Plugin-InsertBlock), released on 2021-04-14.

SYNOPSIS

In dist.ini:

[InsertBlock]

In lib/Baz.pm:

...

# BEGIN_BLOCK: some_code

...

# END_BLOCK

In lib/Foo/Base.pm:

...

=head1 ATTRIBUTES

=for BEGIN_BLOCK: base_attributes

=head2 attr1

=head2 attr2

=for END_BLOCK: base_attributes

...

=head1 METHODS

=over 11

=back BEGIN_BLOCK: base_methods

=head2 meth1

=head2 meth2

=over 11

=back END_BLOCK: base_methods

In lib/Foo/Bar.pm:

...

# INSERT_BLOCK: lib/Baz.pm some_code

...

=head1 ATTRIBUTES

# INSERT_BLOCK: lib/Foo/Base.pm base_attributes

=head2 attr3

...

=head1 METHODS

=INSERT_BLOCK: lib/Foo/Base.pm base_methods

=head2 meth3

...

DESCRIPTION

This plugin finds # INSERT_BLOCK: <file> <name> directive in your POD/code, find the block of text named name in file, and inserts the block of text to replace the directive.

Block is marked/defined using either this syntax:

# BEGIN_BLOCK: Name
...
# END_BLOCK: Name

or this (for block inside POD):

=for BEGIN_BLOCK: Name

...

=for END_BLOCK: Name

or this syntax (for block inside POD, in case tools like Pod::Weaver removes =for directives):

=over 11

=back BEGIN_BLOCK: Name

...

=over 11

=back END_BLOCK: Name

Block name is case-sensitive.

This plugin can be useful to avoid repetition/manual copy-paste, e.g. you want to list POD attributes, methods, etc from a base class into a subclass.

Options

The # INSERT_BLOCK directive accepts an optional third argument for options. Known options:

  • pod_verbatim

    This option pads each line of the block content with whitespace. Suitable for when you are inserting a block into a POD and you want to make the content of the block as POD verbatim.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Dist-Zilla-Plugin-InsertBlock.

SOURCE

Source repository is at https://github.com/perlancar/perl-Dist-Zilla-Plugin-InsertBlock.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-Dist-Zilla-Plugin-InsertBlock/issues

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.

SEE ALSO

Dist::Zilla::Plugin::InsertBlock::FromModule

Dist::Zilla::Plugin::InsertCodeResult

Dist::Zilla::Plugin::InsertCodeOutput

Dist::Zilla::Plugin::InsertCommandOutput

Dist::Zilla::Plugin::InsertExample - which basically insert whole files instead of just a block of text from a file

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2020, 2016, 2015 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.