Test::S...m::Stack(3)
π Test::S...m::Stack(3) π
okay bestie, we're in the Test::Stream::Stack page, from the User Contributed Perl Documentation crew. it's giving "object that manages a stack of hubs" and honestly? obsessed. let's go π¦
β¨ NAME β¨
Test::Stream::Stack β the object that manages a whole stack of Test::Stream::Hub instances. yes, a stack. of hubs. iconic behavior π
π DEPRECATED π
heads up queen, this whole distribution is deprecated β it's been retired in favor of Test2, Test2::Suite, and Test2::Workflow.
there's a conversion guide waiting for you in Test::Stream::Manual::ToTest2. go read it, fr fr. π
π¨ INTERNALS NOTE π¨
okay so this is the part where i hold your hand: the internals of this package are subject to change at ANY time! π±
the public methods? they will not change in backwords-incompatible ways. promise. π€ but the underlying implementation details? they absolutely might shift around.
do NOT break encapsulation here. i am literally begging you. π
πΈ DESCRIPTION πΈ
this module is what you use to represent and manage a stack of Test::Stream::Hub objects. and why do hubs live in a stack, you ask? because that way you can push a brand new hub into place that intercepts and handles events differently than the primary hub. main character energy for the new hub honestly π
β¨ SYNOPSIS β¨
my $stack = Test::Stream::Stack->new;
my $hub = $stack->top;
two lines. that's the whole vibe. slay. π
π METHODS π
$stack = Test::Stream::Stack->new()β this creates a fresh new empty stack instance. every single argument you pass? ignored. don't even bother, bestie, it's not listening π$hub = $stack->new_hub()$hub = $stack->new_hub(%params)$hub = $stack->new_hub(%params, class => $class)
this generates a new hub and pushes it right onto the top of the stack. optionally you can hand it arguments, and those get passed straight into the constructor for the Test::Stream::Hub object. π«Ά
if you specify the 'class' => $class argument, then the new hub will be an instance of that specified class. fancy.
unless your parameters specify 'formatter' or 'ipc' arguments, the formatter and the ipc instance get inherited from the current top hub. and you can set those parameters to undef if you want to avoid having a formatter or an ipc instance at all. no formatter, no ipc, no problem π
and if there's no top hub, and you don't ask to leave ipc and formatter undef? then a new formatter gets created, and the IPC instance from Test::Stream::Sync gets used. the system provides. β¨
$hub = $stack->top()β returns the top hub from the stack. and if there isn't a top hub yet? it just creates one for you. so generous, so giving π₯Ί$hub = $stack->peek()β returns the top hub from the stack, BUT if there's no top hub yet it returnsundef. peek don't create. boundaries, periodt. π§$stack->cullβ calls$hub->cullon all the hubs in the stack. every last one of them. π€@hubs = $stack->allβ returns all the hubs in the stack, as a list. the whole squad, assembled π$stack->clearβ completely removes all hubs from the stack. normally you do not want to do this, bestie, but there are a few valid reasons for it. so like... know why you're doing it before you do it, yk? β οΈ$stack->push($hub)β pushes the new hub onto the stack. simple. clean. we love. π$stack->pop($hub)β pops a hub from the stack. but here's the drama: if the hub at the top of the stack does not match the hub you expected (the one you passed in as an argument)? it will throw an exception. no cap, it will absolutely call you out π
π₯ SOURCE π₯
the source code repository for Test::Stream lives at http://github.com/Test-More/Test-Stream/. go peek, iykyk π
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π AUTHORS π
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright 2015 Chad Granum <exodist7@gmail.com>.
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 the whole page, bestie!! π this doc came to you from perl v5.42.0, dated 2025-07-25, and it's the Test::S...m::Stack(3) page β thanks for reading all the way to the bottom, you're literally the best π«Άπβ¨
π¦ where this page comes from
- fedora 43: perl-Test-Stream 1.302027-35.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms