File Coverage

blib/lib/Feersum.pm
Criterion Covered Total %
statement 26 27 96.3
branch 1 2 50.0
condition 2 4 50.0
subroutine 7 8 87.5
pod 3 3 100.0
total 39 44 88.6


line stmt bran cond sub pod time code
1             package Feersum;
2 30     30   2588812 use 5.008007;
  30         319  
3 30     30   166 use strict;
  30         59  
  30         682  
4 30     30   157 use warnings;
  30         57  
  30         910  
5 30     30   12212 use EV ();
  30         48027  
  30         688  
6 30     30   190 use Carp ();
  30         60  
  30         8297  
7              
8             our $VERSION = '1.407';
9              
10             require Feersum::Connection;
11             require Feersum::Connection::Handle;
12             require XSLoader;
13             XSLoader::load('Feersum', $VERSION);
14              
15             # numify as per
16             # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
17             $VERSION = eval $VERSION; ## no critic (StringyEval, ConstantVersion)
18              
19             our $INSTANCE;
20              
21             sub new {
22 27 50   27 1 35543 unless ($INSTANCE) {
23 27         121 $INSTANCE = bless {}, __PACKAGE__;
24             }
25 27         583 $SIG{PIPE} = 'IGNORE';
26 27         133 return $INSTANCE;
27             }
28             *endjinn = *new;
29              
30             sub use_socket {
31 27     27 1 6331 my ($self, $sock) = @_;
32 27         265 $self->{socket} = $sock;
33 27         114 my $fd = fileno $sock;
34 27         840 $self->accept_on_fd($fd);
35              
36 27   50     80 my $host = eval { $sock->sockhost() } || 'localhost';
37 27   50     2247 my $port = eval { $sock->sockport() } || 80; ## no critic (MagicNumbers)
38 27         985 $self->set_server_name_and_port($host,$port);
39 27         83 return;
40             }
41              
42             # overload this to catch Feersum errors and exceptions thrown by request
43             # callbacks.
44 0     0 1   sub DIED { Carp::confess "DIED: $@"; }
45              
46             1;
47             __END__