This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync cpan/Test-Simple with CPAN version 1.302111.
[perl5.git] / cpan / Test-Simple / lib / Test2 / Hub / Interceptor.pm
CommitLineData
b4514920
CG
1package Test2::Hub::Interceptor;
2use strict;
3use warnings;
4
7358a033 5our $VERSION = '1.302111';
b4514920
CG
6
7
8use Test2::Hub::Interceptor::Terminator();
9
58818a66 10BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) }
b4514920
CG
11use Test2::Util::HashBase;
12
07bc328a
SH
13sub init {
14 my $self = shift;
15 $self->SUPER::init;
16 $self->{+NESTED} = 0;
17}
18
b4514920
CG
19sub inherit {
20 my $self = shift;
21 my ($from, %params) = @_;
22
07bc328a
SH
23 $self->{+NESTED} = 0;
24
b4514920
CG
25 if ($from->{+IPC} && !$self->{+IPC} && !exists($params{ipc})) {
26 my $ipc = $from->{+IPC};
27 $self->{+IPC} = $ipc;
28 $ipc->add_hub($self->{+HID});
29 }
30}
31
32sub terminate {
33 my $self = shift;
34 my ($code) = @_;
7aa7bbc7
SH
35
36 eval {
37 no warnings 'exiting';
38 last T2_SUBTEST_WRAPPER;
39 };
40 my $err = $@;
41
42 # Fallback
43 die bless(\$err, 'Test2::Hub::Interceptor::Terminator');
b4514920
CG
44}
45
461;
47
48__END__
49
50=pod
51
52=encoding UTF-8
53
54=head1 NAME
55
56Test2::Hub::Interceptor - Hub used by interceptor to grab results.
57
58=head1 SOURCE
59
60The source code repository for Test2 can be found at
61F<http://github.com/Test-More/test-more/>.
62
63=head1 MAINTAINERS
64
65=over 4
66
67=item Chad Granum E<lt>exodist@cpan.orgE<gt>
68
69=back
70
71=head1 AUTHORS
72
73=over 4
74
75=item Chad Granum E<lt>exodist@cpan.orgE<gt>
76
77=back
78
79=head1 COPYRIGHT
80
07bc328a 81Copyright 2017 Chad Granum E<lt>exodist@cpan.orgE<gt>.
b4514920
CG
82
83This program is free software; you can redistribute it and/or
84modify it under the same terms as Perl itself.
85
86See F<http://dev.perl.org/licenses/>
87
88=cut