AMQP/Server/Connection.pm

filter: Statementstmt 96.6% 29 / 30 Branchbran 100% 2 / 2 Conditioncond 66.6% 4 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 86.5% 45 / 52 CC 4 SCAR 5.6
CC
4
Cov
92%
on_read
3.0
protocol
2.0
BEGIN
1.0
CRAP 1.7
« AMQP/Server/Protocol.pm ↑ Summary AMQP/Server.pm »
1 package Net::Async::AMQP::Server::Connection;
2 3 $Net::Async::AMQP::Server::Connection::VERSION = '2.000';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use parent qw(IO::Async::Stream);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Net::Async::AMQP::Server::Connection
11  
12 =head1 VERSION
13  
14 version 2.000
15  
16 =head1 SYNOPSIS
17  
18 =head1 DESCRIPTION
19  
20 =cut
21  
22 3 ▶use curry;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 ▶use Net::Async::AMQP;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 ▶use Net::Async::AMQP::Server::Protocol;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 =head1 METHODS
28  
29 =cut
30  
31 =head2 protocol
32  
33 Returns the L<Net::Async::AMQP::Server::Protocol> instance, creating a new one if necessary.
34  
35 =cut
36  
37 9 ▶sub protocol {
Subroutine protocol: called CC=2 SCAR=7.1
Pod documented
38 9 my $self = shift;
39 9 ▶ $self->{protocol} ||= Net::Async::AMQP::Server::Protocol->new(
Condition66%2/3
$self->{"protocol"} ||= "Net::Async::AMQP::Server::Protocol"->new("write", $self->curry::weak::write, "future_factory", $self->loop->curry::weak::new_future)
l!l&&r!l&&!r
810
MC/DC0%0/2
$self->{"protocol"} ||= "Net::Async::AMQP::Server::Protocol"->new("write", $self->curry::weak::write, "future_factory", $self->loop->curry::weak::new_future)
$self->{"protocol"} "Net::Async::AMQP::Server::Protocol"->new("write", $self->curry::weak::write, "future_factory", $self->loop->curry::weak::new_future)
Truth table66%2/3
A ||= B
A= $self->{"protocol"}B= "Net::Async::AMQP::Server::Protocol"->new("write", $self->curry::weak::write, "future_factory", $self->loop->curry::weak::new_future)
ABresult
1X1
011
000
40 write => $self->curry::weak::write,
41 future_factory => $self->loop->curry::weak::new_future,
42 )
43 }
44  
45 =head2 on_read
46  
47 Handle incoming data by passing through to the
48 protocol instance.
49  
50 =cut
51  
52 6 ▶sub on_read {
Subroutine on_read: called CC=3 SCAR=11.1
Pod documented
53 6 my ($self, $buffer, $eof) = @_;
54 6 $self->debug_printf("MQ connection - read %s", $$buffer);
55  
56 6 ▶ $self->{read_handler} ||= $self->protocol->can('on_read');
Condition66%2/3
$self->{"read_handler"} ||= $self->protocol->can("on_read")
l!l&&r!l&&!r
510
MC/DC0%0/2
$self->{"read_handler"} ||= $self->protocol->can("on_read")
$self->{"read_handler"} $self->protocol->can("on_read")
Truth table66%2/3
A ||= B
A= $self->{"read_handler"}B= $self->protocol->can("on_read")
ABresult
1X1
011
000
57 6 while(1) {
58 8 my $code = $self->{read_handler}->(
59 $self->protocol,
60 $buffer,
61 $eof
62 );
63 8 ▶ return $code unless ref $code;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $code 6 2 8
64  
65 # Replace our read handler if necessary
66 2 $self->{read_handler} = $code;
67 }
68 0 die "unreachable"
69 }
70  
71 3 1;
72  
73 __END__
« AMQP/Server/Protocol.pm ↑ Summary AMQP/Server.pm »