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   2564579 use 5.008007;
  30         326  
3 30     30   167 use strict;
  30         57  
  30         683  
4 30     30   157 use warnings;
  30         58  
  30         839  
5 30     30   12154 use EV ();
  30         47454  
  30         692  
6 30     30   225 use Carp ();
  30         63  
  30         8715  
7              
8             our $VERSION = '1.406';
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 34368 unless ($INSTANCE) {
23 27         120 $INSTANCE = bless {}, __PACKAGE__;
24             }
25 27         609 $SIG{PIPE} = 'IGNORE';
26 27         118 return $INSTANCE;
27             }
28             *endjinn = *new;
29              
30             sub use_socket {
31 27     27 1 6289 my ($self, $sock) = @_;
32 27         278 $self->{socket} = $sock;
33 27         126 my $fd = fileno $sock;
34 27         871 $self->accept_on_fd($fd);
35              
36 27   50     73 my $host = eval { $sock->sockhost() } || 'localhost';
37 27   50     2227 my $port = eval { $sock->sockport() } || 80; ## no critic (MagicNumbers)
38 27         1034 $self->set_server_name_and_port($host,$port);
39 27         82 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__