| 1 | # Licensed to the Apache Software Foundation (ASF) under one | ||||||||||
| 2 | # or more contributor license agreements. See the NOTICE file | ||||||||||
| 3 | # distributed with this work for additional information | ||||||||||
| 4 | # regarding copyright ownership. The ASF licenses this file | ||||||||||
| 5 | # to you under the Apache License, Version 2.0 (the | ||||||||||
| 6 | # "License"); you may not use this file except in compliance | ||||||||||
| 7 | # with the License. You may obtain a copy of the License at | ||||||||||
| 8 | # | ||||||||||
| 9 | # https://www.apache.org/licenses/LICENSE-2.0 | ||||||||||
| 10 | # | ||||||||||
| 11 | # Unless required by applicable law or agreed to in writing, | ||||||||||
| 12 | # software distributed under the License is distributed on an | ||||||||||
| 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||||||
| 14 | # KIND, either express or implied. See the License for the | ||||||||||
| 15 | # specific language governing permissions and limitations | ||||||||||
| 16 | # under the License. | ||||||||||
| 17 | |||||||||||
| 18 | package Avro::Protocol::Message; | ||||||||||
| 19 | |||||||||||
| 20 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 1 | ▶ | use Avro::Schema; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 1 | ▶ | use Avro::Protocol; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 1 | ▶ | use Error; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | use Object::Tiny qw{ | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | doc | ||||||||||
| 29 | request | ||||||||||
| 30 | response | ||||||||||
| 31 | errors | ||||||||||
| 32 | 1 | }; | |||||||||
| 33 | |||||||||||
| 34 | 1 | our $VERSION = '1.12.2'; | |||||||||
| 35 | |||||||||||
| 36 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||
| 37 | 1 | my $class = shift; | |||||||||
| 38 | 1 | my $struct = shift; | |||||||||
| 39 | 1 | my $types = shift; | |||||||||
| 40 | |||||||||||
| 41 | my $resp_struct = $struct->{response} | ||||||||||
| 42 | 1 | ▶ | or throw Avro::Protocol::Error::Parse("response is missing"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | |||||||||||
| 44 | my $req_struct = $struct->{request} | ||||||||||
| 45 | 1 | ▶ | or throw Avro::Protocol::Error::Parse("request is missing"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | |||||||||||
| 47 | my $request = [ | ||||||||||
| 48 | 1 | map { Avro::Schema::Field->new($_, $types) } @$req_struct | |||||||||
| 49 | ]; | ||||||||||
| 50 | |||||||||||
| 51 | 1 | my $err_struct = $struct->{errors}; | |||||||||
| 52 | |||||||||||
| 53 | 1 | my $response = Avro::Schema->parse_struct($resp_struct, $types); | |||||||||
| 54 | 1 | ▶ | my $errors = $err_struct ? Avro::Schema->parse_struct($err_struct, $types) : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | |||||||||||
| 56 | return $class->SUPER::new( | ||||||||||
| 57 | doc => $struct->{doc}, | ||||||||||
| 58 | 1 | request => $request, | |||||||||
| 59 | response => $response, | ||||||||||
| 60 | errors => $errors, | ||||||||||
| 61 | ); | ||||||||||
| 62 | |||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 1 | 1; | |||||||||