blib/lib/Thrift/MultiplexedProtocol.pm

filter: Statementstmt 97.6% 42 / 43 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 2 totaltotal 87.5% 56 / 64 CC 3 SCAR 4.2
CC
3
Cov
92%
writeMessageBegin
3.4
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« blib/lib/Thrift/Transport.pm ↑ Summary blib/lib/Thrift/ProtocolDecorator.pm »
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19  
20 1 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use Thrift;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Thrift::MessageType;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Thrift::Protocol;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Thrift::ProtocolDecorator;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 package Thrift::MultiplexedProtocol;
30 1 ▶use base qw(Thrift::ProtocolDecorator);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use version 0.77; our $VERSION = version->declare("$Thrift::VERSION");
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 1 ▶use constant SEPARATOR => ':';
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
36 2 my $classname = shift;
37 2 my $protocol = shift;
38 2 my $serviceName = shift;
39 2 my $self = $classname->SUPER::new($protocol);
40  
41 2 $self->{serviceName} = $serviceName;
42  
43 2 return bless($self,$classname);
44 }
45  
46 #
47 # Writes the message header.
48 # Prepends the service name to the function name, separated by MultiplexedProtocol::SEPARATOR.
49 #
50 # @param string $name Function name.
51 # @param int $type Message type.
52 # @param int $seqid The sequence id of this message.
53 #
54 sub writeMessageBegin
55 11 ▶{
Subroutine writeMessageBegin: called CC=3 SCAR=12.3
Pod undocumented
56 11 my $self = shift;
57 11 my ($name, $type, $seqid) = @_;
58  
59 11 ▶ if ($type == Thrift::TMessageType::CALL || $type == Thrift::TMessageType::ONEWAY) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == 1 or $type == 4) { } 11 0 11
Condition33%1/3
$type == 1 or $type == 4
l!l&&r!l&&!r
1100
MC/DC0%0/2
$type == 1 or $type == 4
$type == 1 $type == 4
Truth table33%1/3
A or B
A= $type == 1B= $type == 4
ABresult
1X1
011
000
60 11 my $nameWithService = $self->{serviceName}.SEPARATOR.$name;
61 11 $self->SUPER::writeMessageBegin($nameWithService, $type, $seqid);
62 }
63 else {
64 0 $self->SUPER::writeMessageBegin($name, $type, $seqid);
65 }
66 }
67  
68 1 1;
« blib/lib/Thrift/Transport.pm ↑ Summary blib/lib/Thrift/ProtocolDecorator.pm »