Debian Codegraph @

upstream/debian-unstable/man3/Test2::API::Stack.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (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 .\"
57 .IX Title "Test2::API::Stack 3perl"
58 .TH Test2::API::Stack 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 Test2::API::Stack \- Object to manage a stack of Test2::Hub
65 instances.
66 .SH "***INTERNALS NOTE***"
67 .IX Header "***INTERNALS NOTE***"
68 \&\fBThe internals of this package are subject to change at any time!\fR The public
69 methods provided will not change in backwards incompatible ways, but the
70 underlying implementation details might. \fBDo not break encapsulation here!\fR
71 .SH DESCRIPTION
72 .IX Header "DESCRIPTION"
73 This module is used to represent and manage a stack of Test2::Hub
74 objects. Hubs are usually in a stack so that you can push a new hub into place
75 that can intercept and handle events differently than the primary hub.
76 .SH SYNOPSIS
77 .IX Header "SYNOPSIS"
78 .Vb 2
79 \& my $stack = Test2::API::Stack\->new;
80 \& my $hub = $stack\->top;
81 .Ve
82 .SH METHODS
83 .IX Header "METHODS"
84 .ie n .IP "$stack = Test2::API::Stack\->\fBnew()\fR" 4
85 .el .IP "\f(CW$stack\fR = Test2::API::Stack\->\fBnew()\fR" 4
86 .IX Item "$stack = Test2::API::Stack->new()"
87 This will create a new empty stack instance. All arguments are ignored.
88 .ie n .IP "$hub = $stack\->\fBnew_hub()\fR" 4
89 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->\fBnew_hub()\fR" 4
90 .IX Item "$hub = $stack->new_hub()"
91 .PD 0
92 .ie n .IP "$hub = $stack\->new_hub(%params)" 4
93 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->new_hub(%params)" 4
94 .IX Item "$hub = $stack->new_hub(%params)"
95 .ie n .IP "$hub = $stack\->new_hub(%params, class => $class)" 4
96 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->new_hub(%params, class => \f(CW$class\fR)" 4
97 .IX Item "$hub = $stack->new_hub(%params, class => $class)"
98 .PD
99 This will generate a new hub and push it to the top of the stack. Optionally
100 you can provide arguments that will be passed into the constructor for the
101 Test2::Hub object.
102 .Sp
103 If you specify the \f(CW\*(C`\*(Aqclass\*(Aq => $class\*(C'\fR argument, the new hub will be an
104 instance of the specified class.
105 .Sp
106 Unless your parameters specify \f(CW\*(Aqformatter\*(Aq\fR or \f(CW\*(Aqipc\*(Aq\fR arguments, the
107 formatter and IPC instance will be inherited from the current top hub. You can
108 set the parameters to \f(CW\*(C`undef\*(C'\fR to avoid having a formatter or IPC instance.
109 .Sp
110 If there is no top hub, and you do not ask to leave IPC and formatter undef,
111 then a new formatter will be created, and the IPC instance from
112 Test2::API will be used.
113 .ie n .IP "$hub = $stack\->\fBtop()\fR" 4
114 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->\fBtop()\fR" 4
115 .IX Item "$hub = $stack->top()"
116 This will return the top hub from the stack. If there is no top hub yet this
117 will create it.
118 .ie n .IP "$hub = $stack\->\fBpeek()\fR" 4
119 .el .IP "\f(CW$hub\fR = \f(CW$stack\fR\->\fBpeek()\fR" 4
120 .IX Item "$hub = $stack->peek()"
121 This will return the top hub from the stack. If there is no top hub yet this
122 will return undef.
123 .ie n .IP $stack\->cull 4
124 .el .IP \f(CW$stack\fR\->cull 4
125 .IX Item "$stack->cull"
126 This will call \f(CW\*(C`$hub\->cull\*(C'\fR on all hubs in the stack.
127 .ie n .IP "@hubs = $stack\->all" 4
128 .el .IP "\f(CW@hubs\fR = \f(CW$stack\fR\->all" 4
129 .IX Item "@hubs = $stack->all"
130 This will return all the hubs in the stack as a list.
131 .ie n .IP $stack\->clear 4
132 .el .IP \f(CW$stack\fR\->clear 4
133 .IX Item "$stack->clear"
134 This will completely remove all hubs from the stack. Normally you do not want
135 to do this, but there are a few valid reasons for it.
136 .ie n .IP $stack\->push($hub) 4
137 .el .IP \f(CW$stack\fR\->push($hub) 4
138 .IX Item "$stack->push($hub)"
139 This will push the new hub onto the stack.
140 .ie n .IP $stack\->pop($hub) 4
141 .el .IP \f(CW$stack\fR\->pop($hub) 4
142 .IX Item "$stack->pop($hub)"
143 This will pop a hub from the stack, if the hub at the top of the stack does not
144 match the hub you expect (passed in as an argument) it will throw an exception.
145 .SH SOURCE
146 .IX Header "SOURCE"
147 The source code repository for Test2 can be found at
148 <https://github.com/Test\-More/test\-more/>.
149 .SH MAINTAINERS
150 .IX Header "MAINTAINERS"
151 .IP "Chad Granum <[email protected]>" 4
152 .IX Item "Chad Granum <[email protected]>"
153 .SH AUTHORS
154 .IX Header "AUTHORS"
155 .PD 0
156 .IP "Chad Granum <[email protected]>" 4
157 .IX Item "Chad Granum <[email protected]>"
158 .PD
159 .SH COPYRIGHT
160 .IX Header "COPYRIGHT"
161 Copyright 2020 Chad Granum <[email protected]>.
162 .PP
163 This program is free software; you can redistribute it and/or
164 modify it under the same terms as Perl itself.
165 .PP
166 See <https://dev.perl.org/licenses/>