Dist::...:KENTNL(3pm)
π Dist::...:KENTNL(3pm) π
okay bestie, so this is the manual page for Dist::...:KENTNL(3pm) and we're gonna get you fluent in it, no cap β¨
πΈ NAME πΈ
Dist::Zilla::Util::Test::KENTNL β it's KENTNL's DZil plugin testing tool, periodt π
β¨ VERSION β¨
version 1.005014 π
π¦ DESCRIPTION π¦
So this module is, like, KENTNL's whole kit for testing Dist::Zilla. It's giving "I made a toolbox and you're welcome" π§°
Most of his modules should be moving to using the dztest model instead, which is more flexible on the source side. Lowkey an upgrade, highkey worth knowing π
π METHODS π
π dztest
Creates a Dist::Zilla::Util::Test::KENTNL object. Like, it just makes one for you. Iconic of it.
This is a much more sane approach to testing than test_config β no notes, it just is π
π test_config
Honestly? This is pretty much the entire reason this module exists. It's a little perverse, but it makes testing WAY easier, and we respect the hustle π
my $plugin = test_config({
dist_root => 'corpus/dist/DZT',
ini => [
'GatherDir',
[ 'Prereqs' => { 'Test::Simple' => '0.88' } ],
],
post_build_callback => sub {
my $config = shift;
# Handy place to put post-construction test code.
die $config->{error} if $config->{error};
},
find_plugin => 'SomePluginName'
});
Also? You can add this section, bestie:
callback => {
method => 'metadata',
args => [],
code => sub {
my $data = shift;
print "Errors ( if any ) $data->{error} ";
dump $data->{response}; # response from ->metadata
$data->{instance}->doMorestuffbyhand();
# ok( .... 'good place for a test!' )
},
}
ngl, I find it easier to do 1-off function wrappers, i.e.:
sub make_plugin {
my @args = @_;
return test_config({
dist_root => 'corpus/dist/DZT',
ini => [
'GatherDir',
[ 'Prereqs' => {'Test::Simple' => '0.88' } ],
[ 'FakePlugin' => {@args } ],
],
post_build_callback => sub {
my $config = shift;
die $config->{error} if $config->{error};
},
find_plugin => 'FakePlugin',
});
}
Which lets us do this lil beauty:
ok( make_plugin( inherit_version => 1 )->inherit_version , 'inherit_verion = 1 propagates' );
π parameters
my $foo = test_config({
dist_root => 'Some/path' # optional, strongly recommended.
ini => [ # optional, strongly recommended.
'BasicPlugin',
[ 'AdvancedPlugin' => { %pluginargs }],
],
build => 0/1 # works fine as 0, 1 tells it to call the ->build() method.
post_build_callback => sub {
my ( $conf ) = shift;
$conf->{error} # any errors that occured during construction/build
$conf->{instance} # the constructed instance
# this is called immediately after construction, do what you will with this.
# mostly for convenience
},
find_plugin => 'Some::Plugin::Name', # makes test_config find and return the plugin that matched that name instead of
# the config instance
callback => { # overrides the return value of find_plugin if it is called
method => 'method_to_call',
args => [qw( hello world )],
code => sub {
my ($conf) = shift;
$conf->{plugin} # the constructed plugin instance
$conf->{error} # any errors discovered when calling ->method( args )
$conf->{instance} # the zilla instance
$conf->{response} # the return value of ->method( args )
# mostly just another convenience of declarative nature.
return someValueHere # this value will be returned by test_config
}
},
});
π AUTHOR π
Kent Fredric <kentnl@cpan.org> π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Kent Fredric <kentnl@cpan.org>. That's the whole vibe, protect the author fr fr π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay, open source π
and that's a wrap, bestie π
this page is from perl v5.34.0, dated 2022-06-13, and yeah the header says Dist::...:KENTNL(3pm) and we're keeping it exactly like that, no notes, we don't question the ellipsis, we simply vibe with it β¨ππ¦
π¦ where this page comes from
- debian bookworm: libdist-zilla-util-test-kentnl-perl 1.005014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdist-zilla-util-test-kentnl-perl 1.005014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdist-zilla-util-test-kentnl-perl 1.005014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdist-zilla-util-test-kentnl-perl 1.005014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdist-zilla-util-test-kentnl-perl 1.005014-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