| 1 | package Test2::Event::V2; | ||||||||||||||||||||||||||||
| 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 | 455 | ▶ | use Scalar::Util qw/reftype/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 455 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 455 | ▶ | BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 455 | ▶ | use Test2::Util::Facets2Legacy qw{ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | causes_fail diagnostics global increments_count no_display sets_plan | ||||||||||||||||||||||||||||
| 14 | subtest_id summary terminate | ||||||||||||||||||||||||||||
| 15 | 455 | }; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 455 | ▶ | use Test2::Util::HashBase qw/-about/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 417 | ▶ | sub non_facet_keys { | ||||||||||||||||||||||||||
|
Subroutine
non_facet_keys: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | return ( | ||||||||||||||||||||||||||||
| 21 | 417 | +UUID, | |||||||||||||||||||||||||||
| 22 | Test2::Util::ExternalMeta::META_KEY(), | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 374 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 374 | my $self = shift; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 374 | my $uuid; | |||||||||||||||||||||||||||
| 30 | 374 | ▶ | if ($uuid = $self->{+UUID}) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 31 | croak "uuid '$uuid' passed to constructor, but uuid '$self->{+ABOUT}->{uuid}' is already set in the 'about' facet" | ||||||||||||||||||||||||||||
| 32 | 4 | ▶ | if $self->{+ABOUT}->{uuid} && $self->{+ABOUT}->{uuid} ne $uuid; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"about"}{"uuid"} and $self->{"about"}{"uuid"} ne $uuid
MC/DC100%2/2
$self->{"about"}{"uuid"} and $self->{"about"}{"uuid"} ne $uuid
$self->{"about"}{"uuid"}
$self->{"about"}{"uuid"} ne $uuid
Truth table100%3/3
A and B
A= $self->{"about"}{"uuid"}B= $self->{"about"}{"uuid"} ne $uuid
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 3 | $self->{+ABOUT}->{uuid} = $uuid; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | ▶ | elsif ($self->{+ABOUT} && $self->{+ABOUT}->{uuid}) { | |||||||||||||||||||||||||||
|
Condition100%3/3
$self->{"about"} and $self->{"about"}{"uuid"}
MC/DC100%2/2
$self->{"about"} and $self->{"about"}{"uuid"}
$self->{"about"}
$self->{"about"}{"uuid"}
Truth table100%3/3
A and B
A= $self->{"about"}B= $self->{"about"}{"uuid"}
| |||||||||||||||||||||||||||||
| 37 | 1 | $uuid = $self->{+ABOUT}->{uuid}; | |||||||||||||||||||||||||||
| 38 | 1 | $self->SUPER::set_uuid($uuid); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # Clone the trace, make sure it is blessed | ||||||||||||||||||||||||||||
| 42 | 373 | ▶ | if (my $trace = $self->{+TRACE}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 367 | $self->{+TRACE} = Test2::EventFacet::Trace->new(%$trace); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 3 | ▶ | sub set_uuid { | ||||||||||||||||||||||||||
|
Subroutine
set_uuid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 49 | 3 | my ($uuid) = @_; | |||||||||||||||||||||||||||
| 50 | 3 | $self->{+ABOUT}->{uuid} = $uuid; | |||||||||||||||||||||||||||
| 51 | 3 | $self->SUPER::set_uuid($uuid); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 416 | ▶ | sub facet_data { | ||||||||||||||||||||||||||
|
Subroutine
facet_data: called CC=9 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 416 | my $self = shift; | |||||||||||||||||||||||||||
| 56 | 416 | my $f = { %{$self} }; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 416 | delete $f->{$_} for $self->non_facet_keys; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 416 | my %out; | |||||||||||||||||||||||||||
| 61 | 416 | for my $k (keys %$f) { | |||||||||||||||||||||||||||
| 62 | 1663 | ▶ | next if substr($k, 0, 1) eq '_'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1262 | ▶ | my $data = $f->{$k} or next; # Key is there, but no facet | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 1262 | ▶ | my $is_list = 'ARRAY' eq (reftype($data) || ''); | ||||||||||||||||||||||||||
|
Condition50%1/2
builtin::reftype($data) || ''
MC/DC0%0/1
builtin::reftype($data) || ''
builtin::reftype($data)
Truth table50%1/2
A
A= builtin::reftype($data)
| |||||||||||||||||||||||||||||
| 66 | 1262 | ▶ | $out{$k} = $is_list ? [ map { {%{$_}} } @$data ] : {%$data}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 416 | ▶ | if (my $meta = $self->meta_facet_data) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 1 | ▶ | $out{meta} = {%$meta, %{$out{meta} || {}}}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$out{'meta'} || {}
MC/DC0%0/1
$out{'meta'} || {}
$out{'meta'}
Truth table50%1/2
A
A= $out{'meta'}
| |||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 416 | return \%out; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 455 | 1; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | __END__ | ||||||||||||||||||||||||||||