Test2:...Module(3perl)
π Test2::Require::Module β from the Perl Programmers Reference Guide, bestie β¨
Okay so this is a page from the Perl Programmers Reference Guide, manual section 3perl, and the module it's teaching you about is literally called Test2:...Module up top but the real name is Test2::Require::Module. Same thing, promise. π«Ά
β¨ NAME β¨
Test2::Require::Module β skip tests if certain packages are not installed, or insufficient versions. π
πΈ DESCRIPTION πΈ
So here's the vibe: sometimes you've got tests that are nice to run, but they depend on tools that might not be there. π
Instead of making the tool a dep, or making the test always skip, the normal move is to make the test run conditionally. That's literally what this package is here for. π
This module is modeled after Test::Requires. The glow-up differences are:
- It's based on Test2 directly, and does not go through
Test::Builder. no cap. - The packages you check for do not get imported into your namespace for you. And that is intentional, bestie. it's giving boundaries. π
π¦ SYNOPSIS π¦
# The test will be skipped unless Some::Module is installed, any version.
use Test2::Require::Module 'Some::Module';
# The test will be skipped unless 'Other::Module' is installed and at
# version '5.555' or greater.
use Test2::Require::Module 'Other::Module' => '5.555';
# We now need to use them directly, Test2::Require::Module does not import
# them for us.
use Some::Module;
use Other::Module;
See that last bit? You gotta use them yourself. It does not do it for you. periodt. π
β SOURCE β
The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. go stare at it, it's iconic. π₯
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>β the main character fr fr π
π AUTHORS π
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/ π§
lowkey important: this one's from perlv5.44.0, dated2026-10-17. that's the whole page, babes β go write some conditional tests, you ate. πβ¨π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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