Debian Codegraph @

upstream/opensuse-tumbleweed/man3/Test2::API::Stack.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Test2::API::Stack 3pm"
61 .TH Test2::API::Stack 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Test2::API::Stack \- Object to manage a stack of Test2::Hub
68 instances.
69 .SH "***INTERNALS NOTE***"
70 .IX Header "***INTERNALS NOTE***"
71 \&\fBThe internals of this package are subject to change at any time!\fR The public
72 methods provided will not change in backwards incompatible ways, but the
73 underlying implementation details might. \fBDo not break encapsulation here!\fR
74 .SH DESCRIPTION
75 .IX Header "DESCRIPTION"
76 This module is used to represent and manage a stack of Test2::Hub
77 objects. Hubs are usually in a stack so that you can push a new hub into place
78 that can intercept and handle events differently than the primary hub.
79 .SH SYNOPSIS
80 .IX Header "SYNOPSIS"
81 .Vb 2
82 \& my $stack = Test2::API::Stack\->new;
83 \& my $hub = $stack\->top;
84 .Ve
85 .SH METHODS
86 .IX Header "METHODS"
87 .ie n .IP "$stack = Test2::API::Stack\->\fBnew()\fR" 4
88 .el .IP "\f(CW$stack\fR = Test2::API::Stack\->\fBnew()\fR" 4
89 .IX Item "$stack = Test2::API::Stack->new()"
90 This will create a new empty stack instance. All arguments are ignored.
91 .ie n .IP "$hub = $stack\->\fBnew_hub()\fR" 4
92 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->\fBnew_hub()\fR" 4
93 .IX Item "$hub = $stack->new_hub()"
94 .PD 0
95 .ie n .IP "$hub = $stack\->new_hub(%params)" 4
96 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->new_hub(%params)" 4
97 .IX Item "$hub = $stack->new_hub(%params)"
98 .ie n .IP "$hub = $stack\->new_hub(%params, class => $class)" 4
99 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->new_hub(%params, class => \f(CW$class\fR)" 4
100 .IX Item "$hub = $stack->new_hub(%params, class => $class)"
101 .PD
102 This will generate a new hub and push it to the top of the stack. Optionally
103 you can provide arguments that will be passed into the constructor for the
104 Test2::Hub object.
105 .Sp
106 If you specify the \f(CW\*(C`\*(Aqclass\*(Aq => $class\*(C'\fR argument, the new hub will be an
107 instance of the specified class.
108 .Sp
109 Unless your parameters specify \f(CW\*(Aqformatter\*(Aq\fR or \f(CW\*(Aqipc\*(Aq\fR arguments, the
110 formatter and IPC instance will be inherited from the current top hub. You can
111 set the parameters to \f(CW\*(C`undef\*(C'\fR to avoid having a formatter or IPC instance.
112 .Sp
113 If there is no top hub, and you do not ask to leave IPC and formatter undef,
114 then a new formatter will be created, and the IPC instance from
115 Test2::API will be used.
116 .ie n .IP "$hub = $stack\->\fBtop()\fR" 4
117 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->\fBtop()\fR" 4
118 .IX Item "$hub = $stack->top()"
119 This will return the top hub from the stack. If there is no top hub yet this
120 will create it.
121 .ie n .IP "$hub = $stack\->\fBpeek()\fR" 4
122 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->\fBpeek()\fR" 4
123 .IX Item "$hub = $stack->peek()"
124 This will return the top hub from the stack. If there is no top hub yet this
125 will return undef.
126 .ie n .IP $stack\->cull 4
127 .el .IP \f(CW$stack\fR\->cull 4
128 .IX Item "$stack->cull"
129 This will call \f(CW\*(C`$hub\->cull\*(C'\fR on all hubs in the stack.
130 .ie n .IP "@hubs = $stack\->all" 4
131 .el .IP "\f(CW@hubs\fR = \f(CW$stack\fR\->all" 4
132 .IX Item "@hubs = $stack->all"
133 This will return all the hubs in the stack as a list.
134 .ie n .IP $stack\->clear 4
135 .el .IP \f(CW$stack\fR\->clear 4
136 .IX Item "$stack->clear"
137 This will completely remove all hubs from the stack. Normally you do not want
138 to do this, but there are a few valid reasons for it.
139 .ie n .IP $stack\->push($hub) 4
140 .el .IP \f(CW$stack\fR\->push($hub) 4
141 .IX Item "$stack->push($hub)"
142 This will push the new hub onto the stack.
143 .ie n .IP $stack\->pop($hub) 4
144 .el .IP \f(CW$stack\fR\->pop($hub) 4
145 .IX Item "$stack->pop($hub)"
146 This will pop a hub from the stack, if the hub at the top of the stack does not
147 match the hub you expect (passed in as an argument) it will throw an exception.
148 .SH SOURCE
149 .IX Header "SOURCE"
150 The source code repository for Test2 can be found at
151 <https://github.com/Test\-More/test\-more/>.
152 .SH MAINTAINERS
153 .IX Header "MAINTAINERS"
154 .IP "Chad Granum <[email protected]>" 4
155 .IX Item "Chad Granum <[email protected]>"
156 .SH AUTHORS
157 .IX Header "AUTHORS"
158 .IP "Chad Granum <[email protected]>" 4
159 .IX Item "Chad Granum <[email protected]>"
160 .SH COPYRIGHT
161 .IX Header "COPYRIGHT"
162 Copyright Chad Granum <[email protected]>.
163 .PP
164 This program is free software; you can redistribute it and/or
165 modify it under the same terms as Perl itself.
166 .PP
167 See <https://dev.perl.org/licenses/>