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   129 use warnings;
  21         46  
  21         658  
6 21     21   110 use strict;
  21         35  
  21         629  
7 21     21   106 use Danga::Socket ();
  21         38  
  21         384  
8 21     21   119 use base qw{Danga::Socket};
  21         42  
  21         3509  
9 21     21   119 use fields qw(worker);
  21         42  
  21         127  
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;