File Coverage

blib/lib/Plack/App/EventSource/Connection.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 3 3 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             package Plack::App::EventSource::Connection;
2              
3 3     3   12757 use strict;
  3         3  
  3         79  
4 3     3   10 use warnings;
  3         3  
  3         272  
5              
6             sub new {
7 4     4 1 1556 my $class = shift;
8 4         8 my (%params) = @_;
9              
10 4         5 my $self = {};
11 4         7 bless $self, $class;
12              
13 4         12 $self->{push_cb} = $params{push_cb};
14 4         15 $self->{close_cb} = $params{close_cb};
15              
16 4         7 return $self;
17             }
18              
19             sub push {
20 3     3 1 14 my $self = shift;
21              
22 3         8 $self->{push_cb}->(@_);
23             }
24              
25             sub close {
26 3     3 1 20 my $self = shift;
27              
28 3         8 $self->{close_cb}->();
29             }
30              
31             1;
32             __END__