Dist::...tstrap(3pm)
π Dist::Zilla::Role::Bootstrap π
okay bestie, welcome to Dist::...tstrap(3pm) β yeah the title got truncated by the terminal, it's giving "my name is too long for this column width" energy π. It lives in the User Contributed Perl Documentation section, and it's a role for Dist::Zilla. Let's get into it π
β¨ NAME β¨
Dist::Zilla::Role::Bootstrap β shared logic for bootstrap things. that's it. that's the whole name. short, sweet, iconic π
πΈ VERSION πΈ
version 1.001004 π¦
π§ SYNOPSIS π§
for the plugin authors out there (the builders, the icon queens π)
use Moose;
with 'Dist::Zilla::Role::Bootstrap';
sub bootstrap {
my $bootstrap_root = $_[0]->_bootstrap_root;
# Do the actual bootstrap work here
$_[0]->_add_inc('./some/path/here');
}
for the plugin users (the ones just vibing in dist.ini π)
[Some::Plugin::Name]
try_built = 0 ; # use / as the root to bootstrap
try_built = 1 ; # try to use /Dist-Name-.*/ instead of /
fallback = 0 ; # don't bootstrap at all if /Dist-Name-.*/ matches != 1 things
fallback = 1 ; # fallback to / if /Dist-Name-.*/ matches != 1 things
π«Ά DESCRIPTION π«Ά
So this module is a role, right? And its whole personality is being consumed by plugins that wanna do some very early bootstrap operation. Like, so early. Before everyone else shows up to the party. π
And why do we care? Because that bootstrap can affect the loading environment of successive plugins β especially the ones that might wanna build with themselves (main character energy tbh). Either by consuming the source tree itself, or by consuming a previous built iteration. no cap.
The implementation is lowkey simple, here's the whole recipe:
withthis role in your plugin
with 'Dist::Zilla::Role::Bootstrap'
- Implement the
bootstrapsub.
sub bootstrap {
my ( $self ) = @_;
}
- Optional: fetch the discovered
bootstraproot via:
$self->_bootstrap_root
- Optional: load some path into
@INCvia:
$self->_add_inc($path)
that's the whole thing bestie, go slay β¨
π₯ REQUIRED METHODS π₯
bootstrap
Any user specified bootstrap method will be invoked during plugin_from_config. π£
This is AFTER ->new, AFTER ->BUILD, and AFTER dzil's internal plugin_from_config steps. (yeah it's a whole queue, everything has its moment π
)
This occurs within the register_component phase of the plug-in loading and configuration.
This also occurs BEFORE Dist::Zilla attaches the plug-in into the plug-in stash. so like, it's early early. β°
π ATTRIBUTES π
distname
The name of the distribution. π¦
This value is vivified by asking zilla->name.
Usually this value is populated by dist.ini in the property name.
However, occasionally, this value is discovered by a plugin. π
In such a case, that plugin cannot be bootstrapped, because that plugin MUST be loaded prior to bootstrap. (chicken-and-egg but make it Perl π)
try_built
This attribute controls how the consuming plugin behaves.
- false (default) : bootstrapping is only done to
PROJECTROOT/lib - true : bootstrap attempts to try
PROJECTROOT/<distname>-<version>/lib
fallback
This attribute is for use in conjunction with try_built. π€
false: WhenPROJECTROOT/<distname>-<version>does not exist, don't perform any bootstrappingtrue(default) : WhenPROJECTROOT/<distname>-<version>does not exist, bootstrap toPROJECTROOT/lib
try_built_method
This attribute controls how try_built behaves when multiple directories exist that match PROJECTROOT/<distname>-.*. (multiple candidates?? it's giving drama πΏ)
Two valid options at this time:
mtime(default) : Pick the directory with the most recentmtimeparseversion: Attempt to parse versions on all candidate directories and use the one with the largest version.
Prior to0.2.0this property did not exist, and default behavior was to assume0 Candidatesand2 or more Candidateswere the same problem. π
π AUTHOR π
Kent Fredric <kentnl@cpan.org> π«‘
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πͺ
and that's a wrap, bestie! this page was rendered by perl v5.34.0 on 2022-06-13, filed under Dist::...tstrap(3pm) π go forth and bootstrap responsibly, ily, bye β¨ππ¦
π¦ where this page comes from
- debian bookworm: libdist-zilla-role-bootstrap-perl 1.001004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdist-zilla-role-bootstrap-perl 1.001004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdist-zilla-role-bootstrap-perl 1.001004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdist-zilla-role-bootstrap-perl 1.001004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdist-zilla-role-bootstrap-perl 1.001004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms