NAME
Dist::Zilla::Plugin::PrecomputeVariable - Precompute variable values during building
VERSION
This document describes version 0.04 of Dist::Zilla::Plugin::PrecomputeVariable (from Perl distribution Dist-Zilla-Plugin-PrecomputeVariable), released on 2016-01-24.
SYNOPSIS
In dist.ini:
[PrecomputeVariable]
variable = $Some::Module::var1
variable = %Some::OtherModule::var2
; add more variables as needed
in your module lib/Some/Module.pm:
package Some::Module;
our $var1 = do { some expensive operation }; # PRECOMPUTE
...
in your module lib/Some/OtherModule.pm:
package Some::OtherModule;
my %Some::OtherModule::var2 = some_expensive_func(); # PRECOMPUTE
...
In the generated lib/Some/Module.pm:
package Some::Module;
our $var1 = ["some", "value"]; # PRECOMPUTED FROM: do { some expensive operation }
...
In the generated lib/Some/OtherModule.pm:
package Some::OtherModule;
my %Some::OtherModule::var2 = ("some", "value"); # PRECOMPUTED FROM: some_expensive_func();
...
DESCRIPTION
This plugin can be used to precompute variables values during build time and put the resulting computed value into the built source code. This is useful in some cases to reduce module startup time, especially if it takes some time to compute the value.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Dist-Zilla-Plugin-PrecomputeVariable.
SOURCE
Source repository is at https://github.com/perlancar/perl-Dist-Zilla-Plugin-Precompute.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-PrecomputeVariable
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
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 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.