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

NAME

Dist::Zilla::Plugin::InsertCodeResult - Insert the result of Perl code into your POD

VERSION

This document describes version 0.056 of Dist::Zilla::Plugin::InsertCodeResult (from Perl distribution Dist-Zilla-Plugin-InsertCodeResult), released on 2023-12-11.

SYNOPSIS

In dist.ini:

 [InsertCodeResult]
 ;make_verbatim=1

In your POD:

 # CODE: require MyLib; MyLib::gen_stuff("some", "param");

or for multiline code:

 # BEGIN_CODE
 require MyLib;
 MyLib::gen_stuff("some", "param");
 ...
 # END_CODE

(you can prefix each line in multiline code with comment, to prevent this code from being analyzed by other analyzers e.g. scan_prereqs):

 # BEGIN_CODE
 #require MyLib;
 #MyLib::gen_stuff("some", "param");
 #...
 # END_CODE

DESCRIPTION

This module finds # CODE: ... or # BEGIN_CODE and # END CODE directives in your POD, evals the specified Perl code, and insert the result into your POD as a verbatim paragraph (unless you set make_verbatim to 0, in which case output will be inserted as-is). If result is a simple scalar, it is printed as is. If it is undef or a reference, it will be dumped using Data::Dump. If eval fails, build will be aborted.

The directives must be at the first column of the line.

HOMEPAGE

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

SOURCE

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

SEE ALSO

Dist::Zilla::Plugin::InsertCodeOutput

Dist::Zilla::Plugin::InsertExample

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023, 2021, 2020, 2019, 2018, 2015, 2014 by perlancar <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.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-InsertCodeResult

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.