Test::...p::Obj(3pm)
π Test::...p::Obj(3pm) β the group chat edition π
okay so bestie, you're looking at Test::...p::Obj(3pm), straight outta the User Contributed Perl Documentation collection. (yes the name is literally truncated with dots in the middle, that's not me being lazy, that's just how it's filed, iykyk β¨) it's a whole module, and no cap, it's a certified banger for debugging your tests.
πΈ NAME πΈ
Test::Run::Trap::Obj β it's a wrapper around Test::Trap for trapping errors. that's it, that's the whole vibe. lowkey iconic π
β¨ SYNOPSIS β¨
here's how you actually use it, copy-paste friendly:
my $got = Test::Run::Trap::Obj->trap_run({
args => [test_files => ["t/sample-tests/simple"]]
});
$got->field_like("stdout", qr/All tests successful/,
"Everything is OK."
);
like. look at that. you trap the run, you get $got, you check the fields. slay π
π¦ DESCRIPTION π¦
so this class is a wrapper around Test::Trap. the whole point β the entire reason she exists β is that when an assertion fails, the diagnostics print out all the relevant and trapped fields for easy debugging. no more sitting there like π§ wondering what actually went wrong. she tells you. main character energy fr fr.
π METHODS π
one bullet per method, because we are thorough and we are cute:
$trapper->diag_all()β callsTest::More'sdiag()with all the trapped fields, likestdout,stderr, etc. basically a full dump of everything she caught. β¨$trapper->field_like($what, $regex, $message)β a wrapper forTest::More'slike(), except it also emits more diagnostics on failure. so when it goes wrong, you get the tea. π$trapper->field_unlike($what, $regex, $msg)β a wrapper forunlike(). same energy, opposite direction. π$trapper->field_is($what, $expected, $msg)β a wrapper foris(). classic. reliable. we love her. π$trapper->field_is_deeply($what, $expected, $msg)β a wrapper foris_deeply(). for when your data structures are deep and you need someone to actually compare them properly. π§my $got = Test::Run::Trap::Obj->trap_run({class => $class, args => \@args, run_func => $func})β runs"$class-"$func()>with the arguments@argsplaced into a hash-ref, traps the results, and returns a results object. the whole trap-and-report pipeline in one call, periodt. π₯
π AUTHOR π
Shlomi Fish, <http://www.shlomifish.org/>. king behaviour. π
π LICENSE π
This file is licensed under the MIT X11 License:
http://www.opensource.org/licenses/mit-license.php
(go read it, it's short, it's giving "do whatever just keep the notice") π
π«Ά SEE ALSO π«Ά
Test::TrapTest::More
go read those too, they're the co-stars of this whole situation. π¦
and that's the page!! perl v5.42.0, dated 2025-07-25, and yes the page is filed under Test::...p::Obj(3pm) β thanks for coming to my ted talk, mwah π
β¨
π¦ where this page comes from
- fedora 43: perl-Test-Run 0.0306-3.fc43 Β· (GPL-1.0-or-later OR Artistic-1.0-Perl) AND GPL-2.0-only AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms