File Coverage

blib/lib/MogileFS/Connection/Parent.pm
Criterion Covered Total %
statement 15 26 57.6
branch 0 2 0.0
condition n/a
subroutine 5 10 50.0
pod 4 5 80.0
total 24 43 55.8


line stmt bran cond sub pod time code
1             package MogileFS::Connection::Parent;
2             # maintains a connection in a worker process to the parent ProcManager process
3             # Only used by workers that use the Danga::Socket->EventLoop internally
4             # currently only Monitor
5 21     21   83 use warnings;
  21         25  
  21         587  
6 21     21   77 use strict;
  21         22  
  21         475  
7 21     21   77 use Danga::Socket ();
  21         25  
  21         286  
8 21     21   73 use base qw{Danga::Socket};
  21         22  
  21         2513  
9 21     21   112 use fields qw(worker);
  21         27  
  21         103  
10              
11             sub new {
12 0     0 1   my ($self, $worker) = @_;
13 0 0         $self = fields::new($self) unless ref $self;
14 0           $self->SUPER::new($worker->psock);
15 0           $self->{worker} = $worker;
16              
17 0           return $self;
18             }
19              
20             sub ping {
21 0     0 0   my ($self) = @_;
22              
23 0           $self->write(":ping\r\n");
24             }
25              
26             sub event_read {
27 0     0 1   my ($self) = @_;
28              
29 0           $self->{worker}->read_from_parent;
30             }
31              
32 0     0 1   sub event_hup { $_[0]->close }
33 0     0 1   sub event_err { $_[0]->close }
34              
35             1;