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 22     22   2422377 use 5.008007;
  22         268  
3 22     22   115 use strict;
  22         52  
  22         504  
4 22     22   106 use warnings;
  22         55  
  22         773  
5 22     22   10982 use EV ();
  22         41546  
  22         490  
6 22     22   137 use Carp ();
  22         40  
  22         5817  
7              
8             our $VERSION = '1.410';
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 21 50   21 1 32466 unless ($INSTANCE) {
23 21         119 $INSTANCE = bless {}, __PACKAGE__;
24             }
25 21         464 $SIG{PIPE} = 'IGNORE';
26 21         97 return $INSTANCE;
27             }
28             *endjinn = *new;
29              
30             sub use_socket {
31 21     21 1 6252 my ($self, $sock) = @_;
32 21         176 $self->{socket} = $sock;
33 21         81 my $fd = fileno $sock;
34 21         668 $self->accept_on_fd($fd);
35              
36 21   50     63 my $host = eval { $sock->sockhost() } || 'localhost';
37 21   50     1620 my $port = eval { $sock->sockport() } || 80; ## no critic (MagicNumbers)
38 21         738 $self->set_server_name_and_port($host,$port);
39 21         59 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__