Test2::API::Stack(3pm)
πΈ NAME πΈ
okay so bestie, welcome to Test2::API::Stack β yes, the 3pm manual page, hi π
β and itβs literally an object to manage a stack of Test2::Hub instances. Thatβs the whole name vibe: Test2::API::Stack β object to manage a stack of Test2::Hub instances. periodt.
π¨ INTERNALS NOTE π¨
real talk, bestie: the internals of this package are subject to change at any time! The public methods provided will not change in backwards incompatible ways, but the underlying implementation details might. Do not break encapsulation here! like, respect the boundary fr fr π«Ά
π¦ DESCRIPTION π¦
This module is used to represent and manage a stack of Test2::Hub objects. Hubs are usually in a stack so that you can push a new hub into place that can intercept and handle events differently than the primary hub. itβs giving βnew hub, new main character energyβ β¨
π SYNOPSIS π
tiny vibe check:
my $stack = Test2::API::Stack->new;
my $hub = $stack->top;
π METHODS π
$stack = Test2::API::Stack->new()β this will create a new empty stack instance. All arguments are ignored. yes, all of them, donβt even worry about it π$hub = $stack->new_hub(),$hub = $stack->new_hub(%params),$hub = $stack->new_hub(%params, class => $class)β this will generate a new hub and push it to the top of the stack. Optionally you can provide arguments that will be passed into the constructor for theTest2::Hubobject.
If you specify the 'class' => $class argument, the new hub will be an instance of the specified class.
Unless your parameters specify 'formatter' or 'ipc' arguments, the formatter and IPC instance will be inherited from the current top hub. You can set the parameters to "undef" to avoid having a formatter or IPC instance.
If there is no top hub, and you do not ask to leave IPC and formatter undef, then a new formatter will be created, and the IPC instance from Test2::API will be used. slay, inheritance drama handled π
$hub = $stack->top()β this will return the top hub from the stack. If there is no top hub yet this will create it. lowkey helpful π$hub = $stack->peek()β this will return the top hub from the stack. If there is no top hub yet this will returnundef. peek, donβt touch π«£$stack->cullβ this will call$hub->cullon all hubs in the stack.@hubs = $stack->allβ this will return all the hubs in the stack as a list. all of them. the whole squad π$stack->clearβ this will completely remove all hubs from the stack. Normally you do not want to do this, but there are a few valid reasons for it. so likeβ¦ proceed with intention, bestie β οΈ$stack->push($hub)β this will push the new hub onto the stack.$stack->pop($hub)β this will pop a hub from the stack, if the hub at the top of the stack does not match the hub you expect (passed in as an argument) it will throw an exception. mismatch = drama = exception, no cap π
π₯ SOURCE π₯
The source code repository for Test2 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 https://dev.perl.org/licenses/
okay thatβs the whole page, bye bestie π«Ά β this is Test2::API::Stack(3pm), from perl v5.42.3, dated 2026-11-03. mwah π
π¦ 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