blib/lib/IPC/Manager/Service/Peer.pm

filter: Statementstmt 90.9% 30 / 33 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 75.0% 3 / 4 totaltotal 90.5% 48 / 53 CC 4 SCAR 6.9
CC
4
Cov
92%
init
4.0
get_response
2.0
BEGIN
1.0
CRAP 2.0
« blib/lib/IPC/Manager/Role/Client/Connection.pm ↑ Summary blib/lib/IPC/Manager/Service/Echo.pm »
1 package IPC::Manager::Service::Peer;
2 201 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 201 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 201 our $VERSION = '0.000036';
6  
7 201 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 201 ▶use Scalar::Util qw/weaken/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 201 use Object::HashBase qw{
11 <name
12 <service
13 <child_pid
14 201 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 5 ▶sub _set_child_pid { $_[0]->{+CHILD_PID} = $_[1] }
Subroutine _set_child_pid: called CC=1 SCAR=0.0
17  
18 sub init {
19 14 ▶ my $self = shift;
Subroutine init: called CC=4 SCAR=13.9
Pod undocumented
20  
21 14 ▶ croak "'name' is required" unless $self->{+NAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"name"} 1 13 14
22  
23 13 ▶ my $service = $self->{+SERVICE} or croak "'service' is required";
Branch: 1 branch
BranchTrueFalseTotal
my $service = $self->{"service"} or croak("'service' is required") 1 12 13
24  
25 12 ▶ croak "'service' must be the current process" unless $service->pid == $$;
Branch: 1 branch
BranchTrueFalseTotal
unless $service->pid == $$ 1 11 12
26  
27 11 weaken($self->{+SERVICE});
28  
29 11 return;
30 }
31  
32 sub ready {
33 12 ▶ my $self = shift;
Subroutine ready: called CC=1 SCAR=0.0
Pod documented
34 12 my ($timeout) = @_;
35 12 $self->{+SERVICE}->client->peer_active($self->{+NAME}, $timeout);
36 }
37  
38 sub send_request {
39 4 ▶ my $self = shift;
Subroutine send_request: called CC=1 SCAR=0.0
Pod documented
40 4 my ($req, $cb) = @_;
41 4 $self->{+SERVICE}->send_request($self->{+NAME}, $req, $cb);
42 }
43  
44 sub get_response {
45 0 ▶ my $self = shift;
Subroutine get_response: not called CC=1 SCAR=6.9
Pod documented
46 0 my ($id) = @_;
47 0 $self->{+SERVICE}->get_response($id);
48 }
49  
50 201 1;
51  
52 __END__
« blib/lib/IPC/Manager/Role/Client/Connection.pm ↑ Summary blib/lib/IPC/Manager/Service/Echo.pm »