| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Test2::Hub::Interceptor; | 
| 2 | 246 |  |  | 246 |  | 2059 | use strict; | 
|  | 246 |  |  |  |  | 502 |  | 
|  | 246 |  |  |  |  | 7484 |  | 
| 3 | 246 |  |  | 246 |  | 1331 | use warnings; | 
|  | 246 |  |  |  |  | 487 |  | 
|  | 246 |  |  |  |  | 9468 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | our $VERSION = '1.302182'; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 246 |  |  | 246 |  | 100195 | use Test2::Hub::Interceptor::Terminator(); | 
|  | 246 |  |  |  |  | 688 |  | 
|  | 246 |  |  |  |  | 9115 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 246 |  |  | 246 |  | 1560 | BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } | 
|  | 246 |  |  |  |  | 8961 |  | 
| 11 | 246 |  |  | 246 |  | 1582 | use Test2::Util::HashBase; | 
|  | 246 |  |  |  |  | 525 |  | 
|  | 246 |  |  |  |  | 1520 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub init { | 
| 14 | 65 |  |  | 65 | 0 | 157 | my $self = shift; | 
| 15 | 65 |  |  |  |  | 410 | $self->SUPER::init(); | 
| 16 | 65 |  |  |  |  | 213 | $self->{+NESTED} = 0; | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub inherit { | 
| 20 | 64 |  |  | 64 | 0 | 136 | my $self = shift; | 
| 21 | 64 |  |  |  |  | 181 | my ($from, %params) = @_; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 64 |  |  |  |  | 166 | $self->{+NESTED} = 0; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 64 | 50 | 66 |  |  | 336 | if ($from->{+IPC} && !$self->{+IPC} && !exists($params{ipc})) { | 
|  |  |  | 33 |  |  |  |  | 
| 26 | 0 |  |  |  |  | 0 | my $ipc = $from->{+IPC}; | 
| 27 | 0 |  |  |  |  | 0 | $self->{+IPC} = $ipc; | 
| 28 | 0 |  |  |  |  | 0 | $ipc->add_hub($self->{+HID}); | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 64 | 100 |  |  |  | 228 | if (my $ls = $from->{+_LISTENERS}) { | 
| 32 | 12 |  |  |  |  | 22 | push @{$self->{+_LISTENERS}} => grep { $_->{intercept_inherit} } @$ls; | 
|  | 12 |  |  |  |  | 32 |  | 
|  | 12 |  |  |  |  | 33 |  | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 64 | 100 |  |  |  | 276 | if (my $pfs = $from->{+_PRE_FILTERS}) { | 
| 36 | 23 |  |  |  |  | 48 | push @{$self->{+_PRE_FILTERS}} => grep { $_->{intercept_inherit} } @$pfs; | 
|  | 23 |  |  |  |  | 86 |  | 
|  | 23 |  |  |  |  | 78 |  | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 | 64 | 50 |  |  |  | 306 | if (my $fs = $from->{+_FILTERS}) { | 
| 40 | 0 |  |  |  |  | 0 | push @{$self->{+_FILTERS}} => grep { $_->{intercept_inherit} } @$fs; | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub clean_inherited { | 
| 45 | 64 |  |  | 64 | 0 | 140 | my $self = shift; | 
| 46 | 64 |  |  |  |  | 268 | my %params = @_; | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | my @sets = ( | 
| 49 |  |  |  |  |  |  | $self->{+_LISTENERS}, | 
| 50 |  |  |  |  |  |  | $self->{+_PRE_FILTERS}, | 
| 51 | 64 |  |  |  |  | 254 | $self->{+_FILTERS}, | 
| 52 |  |  |  |  |  |  | ); | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 64 |  |  |  |  | 180 | for my $set (@sets) { | 
| 55 | 192 | 100 |  |  |  | 546 | next unless $set; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 87 |  |  |  |  | 244 | for my $i (@$set) { | 
| 58 | 87 | 100 |  |  |  | 319 | my $cbs = $i->{intercept_inherit} or next; | 
| 59 | 23 | 50 |  |  |  | 96 | next unless ref($cbs) eq 'HASH'; | 
| 60 | 23 | 50 |  |  |  | 86 | my $cb = $cbs->{clean} or next; | 
| 61 | 23 |  |  |  |  | 107 | $cb->(%params); | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub restore_inherited { | 
| 67 | 63 |  |  | 63 | 0 | 171 | my $self = shift; | 
| 68 | 63 |  |  |  |  | 251 | my %params = @_; | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | my @sets = ( | 
| 71 |  |  |  |  |  |  | $self->{+_FILTERS}, | 
| 72 |  |  |  |  |  |  | $self->{+_PRE_FILTERS}, | 
| 73 | 63 |  |  |  |  | 239 | $self->{+_LISTENERS}, | 
| 74 |  |  |  |  |  |  | ); | 
| 75 |  |  |  |  |  |  |  | 
| 76 | 63 |  |  |  |  | 465 | for my $set (@sets) { | 
| 77 | 189 | 100 |  |  |  | 459 | next unless $set; | 
| 78 |  |  |  |  |  |  |  | 
| 79 | 88 |  |  |  |  | 227 | for my $i (@$set) { | 
| 80 | 89 | 100 |  |  |  | 406 | my $cbs = $i->{intercept_inherit} or next; | 
| 81 | 25 | 50 |  |  |  | 138 | next unless ref($cbs) eq 'HASH'; | 
| 82 | 25 | 50 |  |  |  | 95 | my $cb = $cbs->{restore} or next; | 
| 83 | 25 |  |  |  |  | 486 | $cb->(%params); | 
| 84 |  |  |  |  |  |  | } | 
| 85 |  |  |  |  |  |  | } | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | sub terminate { | 
| 89 | 9 |  |  | 9 | 0 | 23 | my $self = shift; | 
| 90 | 9 |  |  |  |  | 22 | my ($code) = @_; | 
| 91 |  |  |  |  |  |  |  | 
| 92 | 9 |  |  |  |  | 20 | eval { | 
| 93 | 246 |  |  | 246 |  | 2068 | no warnings 'exiting'; | 
|  | 246 |  |  |  |  | 570 |  | 
|  | 246 |  |  |  |  | 21407 |  | 
| 94 | 9 |  |  |  |  | 83 | last T2_SUBTEST_WRAPPER; | 
| 95 |  |  |  |  |  |  | }; | 
| 96 | 1 |  |  |  |  | 3 | my $err = $@; | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | # Fallback | 
| 99 | 1 |  |  |  |  | 8 | die bless(\$err, 'Test2::Hub::Interceptor::Terminator'); | 
| 100 |  |  |  |  |  |  | } | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | 1; | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | __END__ | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | =pod | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =encoding UTF-8 | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | =head1 NAME | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | Test2::Hub::Interceptor - Hub used by interceptor to grab results. | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =head1 SOURCE | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | The source code repository for Test2 can be found at | 
| 117 |  |  |  |  |  |  | F<http://github.com/Test-More/test-more/>. | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head1 MAINTAINERS | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =over 4 | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =item Chad Granum E<lt>exodist@cpan.orgE<gt> | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =back | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =head1 AUTHORS | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =over 4 | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =item Chad Granum E<lt>exodist@cpan.orgE<gt> | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =back | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or | 
| 140 |  |  |  |  |  |  | modify it under the same terms as Perl itself. | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | See F<http://dev.perl.org/licenses/> | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =cut |