Test2::Todo(3pm)
okay bestie, you opened the Test2::Todo(3pm) page from the Perl Programmers Reference Guide and honestly? iconic. let's get into it β¨
π NAME π
Test2::Todo - TODO extension for Test2.
That's the whole name, no cap.
π DESCRIPTION π
Okay so Test2::Todo is an object that lets you create and manage TODO states for tests. It's an extension, not a plugin or a tool. This library can be used by plugins and tools to manage todo states.
If you simply want to write a todo test then you should look at the todo function provided by Test2::Tools::Basic.
πΈ SYNOPSIS πΈ
use Test2::Todo;
# Start the todo
my $todo = Test2::Todo->new(reason => 'Fix later');
# Will be considered todo, so suite still passes
ok(0, "oops");
# End the todo
$todo->end;
# TODO has ended, this test will actually fail.
ok(0, "oops");
π οΈ CONSTRUCTION OPTIONS π οΈ
reason(required) β the reason for the todo. It can be any defined value.hub(optional) β the hub that the TODO state should be applied to. If you don't provide one, the current global hub is used.
π INSTANCE METHODS π
$todo->endβ ends the todo state. That's it, bestie.
π CLASS METHODS π
$count = Test2::Todo->hub_in_todo($hub)β if the hub has any todo objects, this returns the total number of them. If the hub has no todo objects, it returns0.
π OTHER NOTES π
π§ How it works
When an instance is created, a filter sub is added to the Test2::Hub. This filter sets the todo and diag_todo attributes on all events as they come in. When the instance is destroyed, or end() is called, the filter is removed.
When a new hub is pushed (such as when a subtest is started), the new hub inherits the filter, but it will only set diag_todo; it will not set todo on events in child hubs.
π $todo->end is called at destruction
If your $todo object falls out of scope and gets garbage collected, the todo will end.
π«Ά Can I use multiple instances?
Yes. The most recently created one that is still active will win.
π SOURCE π
The source code repository for Test2-Suite can be found at 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/
ok that's the whole page, bestie. It's giving perl v5.42.3, dated 2026-11-03, and yes it's the Test2::Todo(3pm) man page. bye and slay π
π¦ 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