Branch Coverage

blib/lib/PAGI/SSE.pm
Criterion Covered Total %
branch 104 158 65.8


line true false branch
16 1 90 unless $scope and ref $scope eq "HASH"
18 1 89 unless $receive and ref $receive eq "CODE"
20 1 88 unless $send and ref $send eq "CODE"
23 1 87 unless ($scope->{'type'} // "") eq "sse"
28 0 87 if $scope->{'pagi.sse'}
56 0 12 unless defined $str
65 0 8 unless defined $str
66 0 8 $strict ? :
77 0 6 if %opts
79 0 4 $strict ? :
2 4 $raw ? :
80 2 4 if $self->{'scope'}{$cache_key}
86 0 6 unless length $part
96 2 4 $raw ? :
97 2 4 $raw ? :
185 2 45 if $self->is_started or $self->is_closed
191 2 43 if exists $opts{'headers'}
219 6 9 if (lc $pair->[0] eq $name)
229 0 2 if $self->{'scope'}{'pagi.request.headers'}
256 1 9 if $self->is_closed
259 2 7 unless $self->is_started
273 0 5 if $self->is_closed
275 1 4 unless $self->is_started
291 0 15 if $self->is_closed
292 0 15 unless exists $opts{'data'}
294 7 8 unless $self->is_started
298 13 2 if (ref $data)
307 13 2 if defined $opts{'event'}
308 9 6 if defined $opts{'id'}
309 3 12 if defined $opts{'retry'}
319 1 9 if $self->is_closed
322 0 9 unless $self->is_started
328 7 2 if (my $err = $@)
338 0 2 if $self->is_closed
341 0 2 unless $self->is_started
348 0 2 if (my $err = $@)
360 0 1 if $self->is_closed
362 0 1 unless $self->is_started
374 0 1 if $self->is_closed
377 0 1 unless $self->is_started
383 0 1 if (my $err = $@)
393 0 2 if $self->is_closed
396 0 2 unless $self->is_started
399 0 2 if (ref $data)
407 2 0 if defined $opts{'event'}
408 0 2 if defined $opts{'id'}
409 0 2 if defined $opts{'retry'}
413 0 2 if (my $err = $@)
428 2 4 if (builtin::blessed($r) and $r->isa("Future"))
432 2 5 if ($@)
438 2 5 if (not @{$self->{'_on_error'};})
460 2 2 if ($event eq 'close') { }
1 1 elsif ($event eq 'error') { }
476 0 14 if $self->{'_close_callbacks_ran'}
484 1 12 if (builtin::blessed($r) and $r->isa("Future"))
488 0 13 if ($@)
502 0 3 if $self->is_closed
514 1 11 unless $self->is_started
518 1 11 if (my $err = $@)
525 11 0 if ($type eq "sse.disconnect")
540 1 3 unless $self->is_started
545 3 1 if (ref $source eq 'ARRAY') { }
1 0 elsif (ref $source eq 'CODE') { }
547 0 7 if $self->is_closed
552 2 5 if (ref $result eq "HASH")
561 1 3 unless defined $item
565 0 3 if (ref $result eq "HASH")
582 0 1 unless defined $interval and $interval > 0
583 0 1 unless ref $callback eq "CODE"
586 0 1 unless eval { do { require Future::IO; 1 } }
592 1 0 unless $Future::IO::IMPL
596 0 0 unless $self->is_started
604 0 0 unless ($ok)
617 0 0 if ($self->is_closed)
618 0 0 if $sleep_future->can("cancel") and not $sleep_future->is_ready
624 0 0 if $disconnect_future->can("cancel") and not $disconnect_future->is_ready
641 0 0 unless $event
644 0 0 if ($type eq "sse.disconnect")
645 0 0 if ($weak_self)