MAN page from OpenSuSE perl-Perlito5-9.028-lp156.4.1.noarch.rpm
Perlito5X::Test2::API::Stack
Section: User Contributed Perl Documentation (3)
Updated: 2024-12-05
Index NAME
Test2::API::Stack - Object to manage a stack of Test2::Hubinstances.
***INTERNALS NOTE***
The internals of this package are subject to change at any time! The publicmethods provided will not change in backwards incompatible ways, but theunderlying implementation details might.
Do not break encapsulation here! DESCRIPTION
This module is used to represent and manage a stack of Test2::Hubobjects. Hubs are usually in a stack so that you can push a new hub into placethat can intercept and handle events differently than the primary hub.
SYNOPSIS
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.
- $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. Optionallyyou can provide arguments that will be passed into the constructor for theTest2::Hub object.
If you specify the "'class' => $class" argument, the new hub will be aninstance of the specified class.
Unless your parameters specify 'formatter' or 'ipc' arguments, theformatter and IPC instance will be inherited from the current top hub. You canset 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 fromTest2::API will be used.
- $hub = $stack->top()
- This will return the top hub from the stack. If there is no top hub yet thiswill create it.
- $hub = $stack->peek()
- This will return the top hub from the stack. If there is no top hub yet thiswill return undef.
- $stack->cull
- This will call "$hub->cull" on all hubs in the stack.
- @hubs = $stack->all
- This will return all the hubs in the stack as a list.
- $stack->clear
- This will completely remove all hubs from the stack. Normally you do not wantto do this, but there are a few valid reasons for it.
- $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 notmatch the hub you expect (passed in as an argument) it will throw an exception.
SOURCE
The source code repository for Test2 can be found at
http://github.com/Test-More/test-more/.
MAINTAINERS
- Chad Granum <exodistAATTcpan.org>
AUTHORS
- Chad Granum <exodistAATTcpan.org>
COPYRIGHT
Copyright 2016 Chad Granum <exodistAATTcpan.org>.
This program is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
Index
- NAME
- ***INTERNALS NOTE***
- DESCRIPTION
- SYNOPSIS
- METHODS
- SOURCE
- MAINTAINERS
- AUTHORS
- COPYRIGHT
This document was created byman2html,using the manual pages.