TEST2::PLUGIN::UTF8(3pm)
π NAME π
okay so like, Test2::Plugin::UTF8 β it's a Test2 plugin that lets you test with utf8. that's the whole vibe. and yes bestie, this is the page for Test2::...in::UTF8(3pm) from the Perl Programmers Reference Guide, so you're in the right place π«Ά
β¨ DESCRIPTION β¨
the way this plugin just works β when you use it, it makes your tests play nice with utf8. and what does that even mean? two things, bestie:
- it turns on the
utf8pragma - it updates the Test2 output formatter so it uses utf8 too
that's it. that's the slay. π
πΈ SYNOPSIS πΈ
use Test2::Plugin::UTF8;
lowkey this is doing the same thing as this whole situation:
use utf8;
BEGIN {
require Test2::Tools::Encoding;
Test2::Tools::Encoding::set_encoding('utf8');
}
like, same energy, way less typing. iconic behavior honestly. β¨
you can ALSO skip the utf8 import entirely by passing 'encoding_only' β that just enables utf8 encoding on the output format and nothing else:
use Test2::Plugin::UTF8 qw(encoding_only);
π import options π
π¦ encoding_only
does not import utf8 into your test β it only enables the encoding mode on the output. so if you want the output formatted all cute and utf8-y but you don't want the pragma messing with your test file, this is your girl. fr fr. π
π NOTES π
heads up bestie, this is the important part, don't skip it π
this module currently sets output handles to have the ':utf8' output layer. now, some people might prefer ':encoding(utf-8)' because it's way more strict about actually verifying characters. there's a whole debate about whether encoding to utf8 from perl internals can even fail at all β so it may not matter either way. π€·
but here's the real reason it went this way: the alternative causes threads to segfault. yeah. segfault. not cute. see perlbug 31923 β https://rt.perl.org/Public/Bug/Display.html?id=31923 β for the receipts. π
π₯ SOURCE π₯
the source code repository for Test2-Suite lives right here, go be nosy:
https://github.com/Test-More/test-more/
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π 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/
and that's a wrap, bestie πβ¨ this was Test2::...in::UTF8(3pm) from perl v5.42.3, dated 2026-11-03 β go forth and be utf8-coded ππ¦
π¦ 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