Module...equires(3pm)

πŸ’– Module::Install::AuthorRequires β€” the 3pm era, User Contributed Perl Documentation vibes ✨

okay bestie, so this is a Perl manual page (3pm, aka a module man page, from the User Contributed Perl Documentation crew) for Module::Install::AuthorRequires, and it's literally about one thing: making your author-only dependencies a thing. no cap. πŸŽ€


✨ NAME ✨

Module::Install::AuthorRequires β€” declare author-only dependencies πŸ’…


🌸 SYNOPSIS 🌸

author_requires 'Some::Module';
author_requires 'Another::Module' => '0.42';

like. that's it. that's the whole flex. πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

so here's the situation, and it's giving very relatable 😭

Modules often have optional requirements β€” like, dependencies that are handy for (optional) tests but are not required for the module to actually work properly. lowkey optional, highkey useful.

Usually you want all the developers of a project to have these optional modules installed. but the way that simply telling everyone, or printing diagnostic messages when optional deps are missing, just isn't enough to make sure all authors have all the optional modules installed. it's giving "I put it in the group chat and nobody read it" πŸ’€

Module::Install already has a way of detecting an author environment, so an easy way to achieve the above would be something like:

if ($Module::Install::AUTHOR) {
    requires 'Some::Module';
    requires 'Another::Module' => '0.42';
}

and bestie, unfortunately, that'll also make the optional dependencies show up in the distribution's META.yml file, which is obviously wrong, as they aren't actually hard requirements. not me accidentally declaring fake hard deps πŸ™ˆ

working that around requires a considerable amount of non-trivial Makefile.PL hackery, or β€” iconic alternative β€” simply using this module's author_requires command. ✨


πŸ‘‘ COMMANDS πŸ‘‘

author_requires

author_requires $module;
author_requires $module => $version;

this declares a hard dependency, that's only enforced in author environments and is not put in the generated META.yml file of the distribution. periodt. πŸ’…

fr fr: "hard" here means hard for authors only β€” your end users never see it in META.yml. it does not go into the distribution metadata. don't @ me, that's just what the page says. 🫢

🌈 AUTHOR 🌈

Florian Ragwitz <rafl@debian.org> β€” the main character who wrote this πŸ’–


Copyright (c) 2009 Florian Ragwitz

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 the whole page, bestie! 🌸 this one shipped as perl v5.32.0, dated 2021-01-08, under the Module...equires(3pm) banner β€” so if you ever need to cite it, that's the receipt. slay, go declare your author deps. πŸ¦‹πŸ’œβœ¨

πŸ“¦ where this page comes from