CHips L MINI SHELL

CHips L pro

Current Path : /proc/2/root/usr/local/share/man/man3/
Upload File :
Current File : //proc/2/root/usr/local/share/man/man3/Test2::AsyncSubtest.3pm

.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "Test2::AsyncSubtest 3"
.TH Test2::AsyncSubtest 3 "2019-05-18" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Test2::AsyncSubtest \- Object representing an async subtest.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Regular subtests have a limited scope, they start, events are generated, then
they close and send an Test2::Event::Subtest event. This is a problem if you
want the subtest to keep receiving events while other events are also being
generated. This class implements subtests that stay open until you decide to
close them.
.PP
This is mainly useful for tools that start a subtest in one process and then
spawn children. In many cases it is nice to let the parent process continue
instead of waiting on the children.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&    use Test2::AsyncSubtest;
\&
\&    my $ast = Test2::AsyncSubtest\->new(name => foo);
\&
\&    $ast\->run(sub {
\&        ok(1, "Event in parent" );
\&    });
\&
\&    ok(1, "Event outside of subtest");
\&
\&    $ast\->run_fork(sub {
\&        ok(1, "Event in child process");
\&    });
\&
\&    ...
\&
\&    $ast\->finish;
\&
\&    done_testing;
.Ve
.SH "CONSTRUCTION"
.IX Header "CONSTRUCTION"
.Vb 1
\&    my $ast = Test2::AsyncSubtest\->new( ... );
.Ve
.ie n .IP "name => $name (required)" 4
.el .IP "name => \f(CW$name\fR (required)" 4
.IX Item "name => $name (required)"
Name of the subtest. This construction argument is required.
.ie n .IP "send_to => $hub (optional)" 4
.el .IP "send_to => \f(CW$hub\fR (optional)" 4
.IX Item "send_to => $hub (optional)"
Hub to which the final subtest event should be sent. This must be an instance
of Test2::Hub or a subclass. If none is specified then the current top hub
will be used.
.ie n .IP "trace => $trace (optional)" 4
.el .IP "trace => \f(CW$trace\fR (optional)" 4
.IX Item "trace => $trace (optional)"
File/Line to which errors should be attributed. This must be an instance of
Test2::Util::Trace. If none is specified then the file/line where the
constructor was called will be used.
.ie n .IP "hub => $hub (optional)" 4
.el .IP "hub => \f(CW$hub\fR (optional)" 4
.IX Item "hub => $hub (optional)"
Use this to specify a hub the subtest should use. By default a new hub is
generated. This must be an instance of Test2::AsyncSubtest::Hub.
.SH "METHODS"
.IX Header "METHODS"
.SS "\s-1SIMPLE\s0 \s-1ACCESSORS\s0"
.IX Subsection "SIMPLE ACCESSORS"
.ie n .IP "$bool = $ast\->active" 4
.el .IP "\f(CW$bool\fR = \f(CW$ast\fR\->active" 4
.IX Item "$bool = $ast->active"
True if the subtest is active. The subtest is active if its hub appears in the
global hub stack. This is true when \f(CW\*(C`$ast\->run(...)\*(C'\fR us running.
.ie n .IP "$arrayref = $ast\->children" 4
.el .IP "\f(CW$arrayref\fR = \f(CW$ast\fR\->children" 4
.IX Item "$arrayref = $ast->children"
Get an arrayref of child processes/threads. Numerical items are PIDs, blessed
items are threads instances.
.ie n .IP "$arrayref = $ast\->events" 4
.el .IP "\f(CW$arrayref\fR = \f(CW$ast\fR\->events" 4
.IX Item "$arrayref = $ast->events"
Get an arrayref of events that have been sent to the subtests hub.
.ie n .IP "$bool = $ast\->finished" 4
.el .IP "\f(CW$bool\fR = \f(CW$ast\fR\->finished" 4
.IX Item "$bool = $ast->finished"
True if \f(CW\*(C`finished()\*(C'\fR has already been called.
.ie n .IP "$hub = $ast\->hub" 4
.el .IP "\f(CW$hub\fR = \f(CW$ast\fR\->hub" 4
.IX Item "$hub = $ast->hub"
The hub created for the subtest.
.ie n .IP "$int = $ast\->id" 4
.el .IP "\f(CW$int\fR = \f(CW$ast\fR\->id" 4
.IX Item "$int = $ast->id"
Attach/Detach counter. Used internally, not useful to users.
.ie n .IP "$str = $ast\->name" 4
.el .IP "\f(CW$str\fR = \f(CW$ast\fR\->name" 4
.IX Item "$str = $ast->name"
Name of the subtest.
.ie n .IP "$pid = $ast\->pid" 4
.el .IP "\f(CW$pid\fR = \f(CW$ast\fR\->pid" 4
.IX Item "$pid = $ast->pid"
\&\s-1PID\s0 in which the subtest was created.
.ie n .IP "$tid = $ast\->tid" 4
.el .IP "\f(CW$tid\fR = \f(CW$ast\fR\->tid" 4
.IX Item "$tid = $ast->tid"
Thread \s-1ID\s0 in which the subtest was created.
.ie n .IP "$hub = $ast\->send_to" 4
.el .IP "\f(CW$hub\fR = \f(CW$ast\fR\->send_to" 4
.IX Item "$hub = $ast->send_to"
Hub to which the final subtest event should be sent.
.ie n .IP "$arrayref = $ast\->stack" 4
.el .IP "\f(CW$arrayref\fR = \f(CW$ast\fR\->stack" 4
.IX Item "$arrayref = $ast->stack"
Stack of async subtests at the time this one was created. This is mainly for
internal use.
.ie n .IP "$trace = $ast\->trace" 4
.el .IP "\f(CW$trace\fR = \f(CW$ast\fR\->trace" 4
.IX Item "$trace = $ast->trace"
Test2::Util::Trace instance used for error reporting.
.SS "\s-1INTERFACE\s0"
.IX Subsection "INTERFACE"
.ie n .IP "$ast\->attach($id)" 4
.el .IP "\f(CW$ast\fR\->attach($id)" 4
.IX Item "$ast->attach($id)"
Attach a subtest in a child/process to the original.
.Sp
\&\fBNote:\fR \f(CW\*(C`my $id = $ast\->cleave\*(C'\fR must have been called in the parent
process/thread before the child was started, the id it returns must be used in
the call to \f(CW\*(C`$ast\->attach($id)\*(C'\fR
.ie n .IP "$id = $ast\->cleave" 4
.el .IP "\f(CW$id\fR = \f(CW$ast\fR\->cleave" 4
.IX Item "$id = $ast->cleave"
Prepare a slot for a child process/thread to attach. This must be called \s-1BEFORE\s0
the child process or thread is started. The \s-1ID\s0 returned is used by \f(CW\*(C`attach()\*(C'\fR.
.Sp
This must only be called in the original process/thread.
.ie n .IP "$ctx = $ast\->context" 4
.el .IP "\f(CW$ctx\fR = \f(CW$ast\fR\->context" 4
.IX Item "$ctx = $ast->context"
Get an Test2::API::Context instance that can be used to send events to the
context in which the hub was created. This is not a canonical context, you
should not call \f(CW\*(C`$ctx\->release\*(C'\fR on it.
.ie n .IP "$ast\->detach" 4
.el .IP "\f(CW$ast\fR\->detach" 4
.IX Item "$ast->detach"
Detach from the parent in a child process/thread. This should be called just
before the child exits.
.ie n .IP "$ast\->finish" 4
.el .IP "\f(CW$ast\fR\->finish" 4
.IX Item "$ast->finish"
.PD 0
.ie n .IP "$ast\->finish(%options)" 4
.el .IP "\f(CW$ast\fR\->finish(%options)" 4
.IX Item "$ast->finish(%options)"
.PD
Finish the subtest, wait on children, and send the final subtest event.
.Sp
This must only be called in the original process/thread.
.Sp
\&\fBNote:\fR This calls \f(CW\*(C`$ast\->wait\*(C'\fR.
.Sp
These are the options:
.RS 4
.IP "collapse => 1" 4
.IX Item "collapse => 1"
This intelligently allows a subtest to be empty.
.Sp
If no events bump the test count then the subtest no final plan will be added.
The subtest will not be considered a failure (normally an empty subtest is a
failure).
.Sp
If there are no events at all the subtest will be collapsed into an
Test2::Event::Ok event.
.IP "silent => 1" 4
.IX Item "silent => 1"
This will prevent finish from generating a final Test2::Event::Subtest
event. This effectively ends the subtest without it effecting the parent
subtest (or top level test).
.IP "no_plan => 1" 4
.IX Item "no_plan => 1"
This will prevent a final plan from being added to the subtest for you when
none is directly specified.
.ie n .IP "skip => ""reason""" 4
.el .IP "skip => ``reason''" 4
.IX Item "skip => reason"
This will issue an Test2::Event::Skip instead of a subtest. This will throw
an exception if any events have been seen, or if state implies events have
occurred.
.RE
.RS 4
.RE
.ie n .IP "$out = $ast\->fork" 4
.el .IP "\f(CW$out\fR = \f(CW$ast\fR\->fork" 4
.IX Item "$out = $ast->fork"
This is a slightly higher level interface to fork. Running it will fork your
code in-place just like \f(CW\*(C`fork()\*(C'\fR. It will return a pid in the parent, and an
Scope::Guard instance in the child. An exception will be thrown if fork
fails.
.Sp
It is recommended that you use \f(CW\*(C`$ast\->run_fork(sub { ... })\*(C'\fR instead.
.ie n .IP "$bool = $ast\->pending" 4
.el .IP "\f(CW$bool\fR = \f(CW$ast\fR\->pending" 4
.IX Item "$bool = $ast->pending"
True if there are child processes, threads, or subtests that depend on this
one.
.ie n .IP "$bool = $ast\->ready" 4
.el .IP "\f(CW$bool\fR = \f(CW$ast\fR\->ready" 4
.IX Item "$bool = $ast->ready"
This is essentially \f(CW\*(C`!$ast\->pending\*(C'\fR.
.ie n .IP "$ast\->run(sub { ... })" 4
.el .IP "\f(CW$ast\fR\->run(sub { ... })" 4
.IX Item "$ast->run(sub { ... })"
Run the provided codeblock inside the subtest. This will push the subtest hub
onto the stack, run the code, then pop the hub off the stack.
.ie n .IP "$pid = $ast\->run_fork(sub { ... })" 4
.el .IP "\f(CW$pid\fR = \f(CW$ast\fR\->run_fork(sub { ... })" 4
.IX Item "$pid = $ast->run_fork(sub { ... })"
Same as \f(CW\*(C`$ast\->run()\*(C'\fR, except that the codeblock is run in a child
process.
.Sp
You do not need to directly call \f(CW\*(C`wait($pid)\*(C'\fR, that will be done for you when
\&\f(CW\*(C`$ast\->wait\*(C'\fR, or \f(CW\*(C`$ast\->finish\*(C'\fR are called.
.ie n .IP "my $thr = $ast\->run_thread(sub { ... });" 4
.el .IP "my \f(CW$thr\fR = \f(CW$ast\fR\->run_thread(sub { ... });" 4
.IX Item "my $thr = $ast->run_thread(sub { ... });"
\&\fB** \s-1DISCOURAGED\s0 **\fR Threads cause problems. This method remains for anyone who
\&\s-1REALLY\s0 wants it, but it is no longer supported. Tests for this functionality do
not even run unless the \s-1AUTHOR_TESTING\s0 or T2_DO_THREAD_TESTS env vars are
enabled.
.Sp
Same as \f(CW\*(C`$ast\->run()\*(C'\fR, except that the codeblock is run in a child
thread.
.Sp
You do not need to directly call \f(CW\*(C`$thr\->join\*(C'\fR, that is done for you when
\&\f(CW\*(C`$ast\->wait\*(C'\fR, or \f(CW\*(C`$ast\->finish\*(C'\fR are called.
.ie n .IP "$passing = $ast\->start" 4
.el .IP "\f(CW$passing\fR = \f(CW$ast\fR\->start" 4
.IX Item "$passing = $ast->start"
Push the subtest hub onto the stack. Returns the current pass/fail status of
the subtest.
.ie n .IP "$ast\->stop" 4
.el .IP "\f(CW$ast\fR\->stop" 4
.IX Item "$ast->stop"
Pop the subtest hub off the stack. Returns the current pass/fail status of the
subtest.
.ie n .IP "$ast\->wait" 4
.el .IP "\f(CW$ast\fR\->wait" 4
.IX Item "$ast->wait"
Wait on all threads/processes that were started using \f(CW\*(C`$ast\->fork\*(C'\fR,
\&\f(CW\*(C`$ast\->run_fork\*(C'\fR, or \f(CW\*(C`$ast\->run_thread\*(C'\fR.
.SH "SOURCE"
.IX Header "SOURCE"
The source code repository for Test2\-AsyncSubtest can be found at
\&\fIhttps://github.com/Test\-More/Test2\-Suite/\fR.
.SH "MAINTAINERS"
.IX Header "MAINTAINERS"
.IP "Chad Granum <exodist@cpan.org>" 4
.IX Item "Chad Granum <exodist@cpan.org>"
.SH "AUTHORS"
.IX Header "AUTHORS"
.PD 0
.IP "Chad Granum <exodist@cpan.org>" 4
.IX Item "Chad Granum <exodist@cpan.org>"
.PD
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2018 Chad Granum <exodist7@gmail.com>.
.PP
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
.PP
See \fIhttp://dev.perl.org/licenses/\fR

Copyright 2K16 - 2K18 Indonesian Hacker Rulez