Dist::Zilla::Role::PERLANCAR::WriteModules - Role to write modules to disk to a specified directory
This document describes version 0.02 of Dist::Zilla::Role::PERLANCAR::WriteModules (from Perl distribution Dist-Zilla-Role-PERLANCAR-WriteModules), released on 2015-07-27.
Rationale: in the middle of a build process, sometimes we want to write the built version of modules to disk (as actual files). The problem is, Dist::Zilla writes the dist to disk at the end of build.
An example of this is with Dist::Zilla::Plugin::GenPericmdScript which generates scripts in the file gathering step. Or, Dist::Zilla::Plugin::Depak which replaces scripts with packed version in the file munging step. These generated scripts might embed modules inside them, including from the current dist we're building, and we need the built version of these modules instead of the raw version.
So this role can be used to write the built modules (so far, at that point) to a temporary directory.
If already written modules to dir, will contain the directory name. Otherwise, undef.
Write built modules to disk at the specified directory (or, to a temporary directory if $dir is not specified).
$dir
To find out the directory being used, use the written_modules_dir attribute.
written_modules_dir
If a temporary directory is automatically selected, it will automatically be cleaned up at the end of build (created using File::Temp's tempdir with CLEANUP set to 1) unless the environment DEBUG is set to true, in which case the temporary directory will not be automatically cleaned up.
tempdir
CLEANUP
DEBUG
By default will only do this once during build, and subsequent call to write_modules_to_dir() will be a no-op. But if you set $force to 1, will write modules to disk even if it has been done previously during the same build.
write_modules_to_dir()
$force
Dist::Zilla::Dist::Builder the module which dzil uses to write the dist and archive to disk, usually at the end of build.
Please visit the project's homepage at https://metacpan.org/release/Dist-Zilla-Role-PERLANCAR-WriteModules.
Source repository is at https://github.com/perlancar/perl-Dist-Zilla-Role-PERLANCAR-WriteModules.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Role-PERLANCAR-WriteModules
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 <perlancar@cpan.org>
This software is copyright (c) 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.
To install Dist::Zilla::Role::PERLANCAR::WriteModules, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Role::PERLANCAR::WriteModules
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Role::PERLANCAR::WriteModules
For more information on module installation, please visit the detailed CPAN module installation guide.