<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Test2::AsyncSubtest::Hub;
use strict;
use warnings;

our $VERSION = '0.000162';

use base 'Test2::Hub::Subtest';
use Test2::Util::HashBase qw/ast_ids ast/;
use Test2::Util qw/get_tid/;

sub init {
    my $self = shift;

    $self-&gt;SUPER::init();

    if (my $format = $self-&gt;format) {
        my $hide = $format-&gt;can('hide_buffered') ? $format-&gt;hide_buffered : 1;
        $self-&gt;format(undef) if $hide;
    }
}

sub inherit {
    my $self = shift;
    my ($from, %params) = @_;

    if (my $ls = $from-&gt;{+_LISTENERS}) {
        push @{$self-&gt;{+_LISTENERS}} =&gt; grep { $_-&gt;{inherit} } @$ls;
    }

    if (my $pfs = $from-&gt;{+_PRE_FILTERS}) {
        push @{$self-&gt;{+_PRE_FILTERS}} =&gt; grep { $_-&gt;{inherit} } @$pfs;
    }

    if (my $fs = $from-&gt;{+_FILTERS}) {
        push @{$self-&gt;{+_FILTERS}} =&gt; grep { $_-&gt;{inherit} } @$fs;
    }
}

sub send {
    my $self = shift;
    my ($e) = @_;

    if (my $ast = $self-&gt;ast) {
        if ($$ != $ast-&gt;pid || get_tid != $ast-&gt;tid) {
            if (my $plan = $e-&gt;facet_data-&gt;{plan}) {
                unless ($plan-&gt;{skip}) {
                    my $trace = $e-&gt;facet_data-&gt;{trace};
                    bless($trace, 'Test2::EventFacet::Trace');
                    $trace-&gt;alert("A plan should not be set inside an async-subtest (did you call done_testing()?)");
                    return;
                }
            }
        }
    }

    return $self-&gt;SUPER::send($e);
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Test2::AsyncSubtest::Hub - Hub used by async subtests.

=head1 DESCRIPTION

This is a subclass of L&lt;Test2::Hub::Subtest&gt; used for async subtests.

=head1 SYNOPSIS

You should not use this directly.

=head1 METHODS

=over 4

=item $ast = $hub-&gt;ast

Get the L&lt;Test2::AsyncSubtest&gt; object to which this hub is bound.

=back

=head1 SOURCE

The source code repository for Test2-AsyncSubtest can be found at
F&lt;https://github.com/Test-More/Test2-Suite/&gt;.

=head1 MAINTAINERS

=over 4

=item Chad Granum E&lt;lt&gt;exodist@cpan.orgE&lt;gt&gt;

=back

=head1 AUTHORS

=over 4

=item Chad Granum E&lt;lt&gt;exodist@cpan.orgE&lt;gt&gt;

=back

=head1 COPYRIGHT

Copyright 2018 Chad Granum E&lt;lt&gt;exodist7@gmail.comE&lt;gt&gt;.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

See F&lt;http://dev.perl.org/licenses/&gt;

=cut
</pre></body></html>