Branch Coverage

blib/lib/PAGI/SSE.pm
Criterion Covered Total %
branch 119 174 68.3


line true false branch
17 1 97 unless $scope and ref $scope eq "HASH"
19 1 96 unless $receive and ref $receive eq "CODE"
21 1 95 unless $send and ref $send eq "CODE"
24 1 94 unless ($scope->{'type'} // "") eq "sse"
29 0 94 if $scope->{'pagi.sse'}
57 0 12 unless defined $str
66 0 8 unless defined $str
67 0 8 $strict ? :
78 0 6 if %opts
80 0 4 $strict ? :
2 4 $raw ? :
81 2 4 if $self->{'scope'}{$cache_key}
87 0 6 unless length $part
97 2 4 $raw ? :
98 2 4 $raw ? :
174 1 1 unless $t
181 1 1 unless $t
188 1 1 unless $t
195 1 1 if $t and $t->can("on_high_water")
202 1 1 if $t and $t->can("on_drain")
209 1 2 unless $t
211 0 2 unless defined $high
212 1 1 $t->buffered_amount < $high ? :
231 2 45 if $self->is_started or $self->is_closed
237 2 43 if exists $opts{'headers'}
265 6 9 if (lc $pair->[0] eq $name)
275 0 2 if $self->{'scope'}{'pagi.request.headers'}
302 1 9 if $self->is_closed
305 2 7 unless $self->is_started
319 0 5 if $self->is_closed
321 1 4 unless $self->is_started
337 0 15 if $self->is_closed
338 0 15 unless exists $opts{'data'}
340 7 8 unless $self->is_started
344 13 2 if (ref $data)
353 13 2 if defined $opts{'event'}
354 9 6 if defined $opts{'id'}
355 3 12 if defined $opts{'retry'}
365 1 9 if $self->is_closed
368 0 9 unless $self->is_started
374 7 2 if (my $err = $@)
384 0 2 if $self->is_closed
387 0 2 unless $self->is_started
394 0 2 if (my $err = $@)
406 0 1 if $self->is_closed
408 0 1 unless $self->is_started
420 0 1 if $self->is_closed
423 0 1 unless $self->is_started
429 0 1 if (my $err = $@)
439 0 2 if $self->is_closed
442 0 2 unless $self->is_started
445 0 2 if (ref $data)
453 2 0 if defined $opts{'event'}
454 0 2 if defined $opts{'id'}
455 0 2 if defined $opts{'retry'}
459 0 2 if (my $err = $@)
474 2 4 if (builtin::blessed($r) and $r->isa("Future"))
478 2 5 if ($@)
484 2 5 if (not @{$self->{'_on_error'};})
506 2 2 if ($event eq 'close') { }
1 1 elsif ($event eq 'error') { }
522 0 14 if $self->{'_close_callbacks_ran'}
530 1 12 if (builtin::blessed($r) and $r->isa("Future"))
534 0 13 if ($@)
548 0 3 if $self->is_closed
560 1 11 unless $self->is_started
564 1 11 if (my $err = $@)
571 11 0 if ($type eq "sse.disconnect")
586 1 3 unless $self->is_started
591 3 1 if (ref $source eq 'ARRAY') { }
1 0 elsif (ref $source eq 'CODE') { }
593 0 7 if $self->is_closed
598 2 5 if (ref $result eq "HASH")
607 1 3 unless defined $item
611 0 3 if (ref $result eq "HASH")
628 0 1 unless defined $interval and $interval > 0
629 0 1 unless ref $callback eq "CODE"
632 0 1 unless eval { do { require Future::IO; 1 } }
638 1 0 unless $Future::IO::IMPL
642 0 0 unless $self->is_started
650 0 0 unless ($ok)
663 0 0 if ($self->is_closed)
664 0 0 if $sleep_future->can("cancel") and not $sleep_future->is_ready
670 0 0 if $disconnect_future->can("cancel") and not $disconnect_future->is_ready
687 0 0 unless $event
690 0 0 if ($type eq "sse.disconnect")
691 0 0 if ($weak_self)