File Coverage

blib/lib/HTTP/Proxy/Engine/NoFork.pm
Criterion Covered Total %
statement 3 12 25.0
branch n/a
condition n/a
subroutine 1 3 33.3
pod 2 2 100.0
total 6 17 35.2


line stmt bran cond sub pod time code
1             package HTTP::Proxy::Engine::NoFork;
2             $HTTP::Proxy::Engine::NoFork::VERSION = '0.304';
3 1     1   971 use strict;
  1         1  
  1         138  
4              
5             our @ISA = qw( HTTP::Proxy::Engine );
6              
7             __PACKAGE__->make_accessors( 'select' );
8              
9             sub start {
10 0     0 1   my $self = shift;
11 0           my $proxy = $self->proxy;
12              
13 0           $self->select( IO::Select->new( $proxy->daemon ) );
14              
15             # clients will not block the proxy by keeping the connection open
16 0           $proxy->max_keep_alive_requests( 1 );
17             }
18              
19             sub run {
20 0     0 1   my $self = shift;
21 0           my $proxy = $self->proxy;
22              
23             # check for new connections
24 0           for my $fh ( $self->select->can_read() ) { # there's only one, anyway
25              
26             # single-process proxy
27 0           $proxy->serve_connections( $fh->accept );
28 0           $proxy->new_connection;
29             }
30             }
31              
32             1;
33              
34             __END__