Test::use::ok(3pm)
β¨ Test::use::ok β¨
okay bestie so this is a page from the Perl Programmers Reference Guide β Test::use::ok(3pm) to be exact β and it's literally the glow-up your test scripts have been waiting for π
π NAME π
Test::use::ok β the alternative to Test::More::use_ok. That's it, that's the whole vibe. π
π¦ SYNOPSIS π¦
use ok 'Some::Module';
look at that. a single space is doing SO much work here, i'm obsessed π
πΈ DESCRIPTION πΈ
ok so according to the Test::More documentation, the recommendation is to run use_ok() inside a BEGIN block β that way functions get exported at compile-time and prototypes are properly honored. periodt. β¨
basically, instead of writing this:
use_ok( 'Some::Module' );
use_ok( 'Other::Module' );
you should be writing this:
BEGIN { use_ok( 'Some::Module' ); }
BEGIN { use_ok( 'Other::Module' ); }
but here's the thing β and ngl this is so real of us β people often either forget to add BEGIN, or they mistakenly group use_ok with other tests in a single BEGIN block, which "can create subtle differences in execution order." subtle differences!! in execution order!! the chaos π
with this module, you simply change all use_ok in test scripts to use ok, and they will be executed at BEGIN time. iconic behavior. and the explicit space after use makes it clear that this is a single compile-time action β one action, one moment, main character energy π
fr fr: that space isn't just cute, it's communicative. it's telling you "hey bestie, this all happens at compile time, as one thing." slay π
π₯ SEE ALSO π₯
Test::Moreβ the og, the source of the recommendation above π«Ά
π MAINTAINER π
Chad Granum <exodist@cpan.org> β holding it down π
π CC0 1.0 Universal π
To the extent possible under law, ει³³ has waived all copyright and related or neighboring rights to Test::use::ok.
This work is published from Taiwan.
<https://creativecommons.org/publicdomain/zero/1.0/>
that's a public domain dedication, bestie β generous to a degree that is genuinely iconic π
β and that's the whole page!! it shipped as part of perl v5.42.3, dated 2026-11-03, and it lives at Test::use::ok(3pm). go forth and use ok responsibly ππ¦β¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms