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

our $VERSION = '0.000162';

use base 'Test2::Event';
use Test2::Util::HashBase qw/id/;

sub no_display { 1 }

sub callback {
    my $self = shift;
    my ($hub) = @_;

    my $id = $self-&gt;{+ID};
    my $ids = $hub-&gt;ast_ids;

    unless (defined $ids-&gt;{$id}) {
        require Test2::Event::Exception;
        my $trace = $self-&gt;trace;
        $hub-&gt;send(
            Test2::Event::Exception-&gt;new(
                trace =&gt; $trace,
                error =&gt; "Invalid AsyncSubtest attach ID: $id at " . $trace-&gt;debug . "\n",
            )
        );
        return;
    }

    if ($ids-&gt;{$id}++) {
        require Test2::Event::Exception;
        my $trace = $self-&gt;trace;
        $hub-&gt;send(
            Test2::Event::Exception-&gt;new(
                trace =&gt; $trace,
                error =&gt; "AsyncSubtest ID $id already attached at " . $trace-&gt;debug . "\n",
            )
        );
        return;
    }
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Test2::AsyncSubtest::Event::Attach - Event to attach a subtest to the parent.

=head1 DESCRIPTION

Used internally by L&lt;Test2::AsyncSubtest&gt;. No user serviceable parts inside.

=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>