| 1 | package Test2::Hub::Interceptor; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 455 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 455 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 455 | our $VERSION = '1.302226'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 455 | ▶ | use Test2::Hub::Interceptor::Terminator(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 455 | ▶ | BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 455 | ▶ | use Test2::Util::HashBase; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 412 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 412 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 412 | $self->SUPER::init(); | |||||||||||||||||||||||||||||||||||||||||
| 16 | 412 | $self->{+NESTED} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 411 | ▶ | sub inherit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherit: called CC=7 SCAR=21.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 411 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 411 | my ($from, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 411 | $self->{+NESTED} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 411 | ▶ | if ($from->{+IPC} && !$self->{+IPC} && !exists($params{ipc})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$from->{"ipc"} and not $self->{"ipc"} and not exists $params{"ipc"}
$from->{"ipc"} and not $self->{"ipc"}
MC/DC0%0/3
$from->{"ipc"} and not $self->{"ipc"} and not exists $params{"ipc"}
$from->{"ipc"}
not $self->{"ipc"}
not exists $params{"ipc"}
Truth table50%2/4
A and not(B) and not(C)
A= $from->{"ipc"}B= not $self->{"ipc"}C= not exists $params{"ipc"}
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my $ipc = $from->{+IPC}; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $self->{+IPC} = $ipc; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $ipc->add_hub($self->{+HID}); | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 411 | ▶ | if (my $ls = $from->{+_LISTENERS}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 244 | push @{$self->{+_LISTENERS}} => grep { $_->{intercept_inherit} } @$ls; | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 411 | ▶ | if (my $pfs = $from->{+_PRE_FILTERS}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 28 | push @{$self->{+_PRE_FILTERS}} => grep { $_->{intercept_inherit} } @$pfs; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 411 | ▶ | if (my $fs = $from->{+_FILTERS}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | push @{$self->{+_FILTERS}} => grep { $_->{intercept_inherit} } @$fs; | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 413 | ▶ | sub clean_inherited { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clean_inherited: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 413 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 413 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | my @sets = ( | ||||||||||||||||||||||||||||||||||||||||||
| 49 | $self->{+_LISTENERS}, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | $self->{+_PRE_FILTERS}, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 413 | $self->{+_FILTERS}, | |||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 413 | for my $set (@sets) { | |||||||||||||||||||||||||||||||||||||||||
| 55 | 1239 | ▶ | next unless $set; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 441 | for my $i (@$set) { | |||||||||||||||||||||||||||||||||||||||||
| 58 | 440 | ▶ | my $cbs = $i->{intercept_inherit} or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 27 | ▶ | next unless ref($cbs) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 27 | ▶ | my $cb = $cbs->{clean} or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 27 | $cb->(%params); | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 404 | ▶ | sub restore_inherited { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
restore_inherited: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 404 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 404 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | my @sets = ( | ||||||||||||||||||||||||||||||||||||||||||
| 71 | $self->{+_FILTERS}, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | $self->{+_PRE_FILTERS}, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 404 | $self->{+_LISTENERS}, | |||||||||||||||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 404 | for my $set (@sets) { | |||||||||||||||||||||||||||||||||||||||||
| 77 | 1212 | ▶ | next unless $set; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 435 | for my $i (@$set) { | |||||||||||||||||||||||||||||||||||||||||
| 80 | 434 | ▶ | my $cbs = $i->{intercept_inherit} or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 29 | ▶ | next unless ref($cbs) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 29 | ▶ | my $cb = $cbs->{restore} or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 29 | $cb->(%params); | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 17 | ▶ | sub terminate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
terminate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 17 | my ($code) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 17 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 93 | 455 | ▶ | no warnings 'exiting'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 17 | last T2_SUBTEST_WRAPPER; | |||||||||||||||||||||||||||||||||||||||||
| 95 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | # Fallback | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | die bless(\$err, 'Test2::Hub::Interceptor::Terminator'); | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 455 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | __END__ | ||||||||||||||||||||||||||||||||||||||||||