| line | stmt | bran | cond | sub | pod | time | code | 
| 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 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | use strict; | 
| 20 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 24 |  | 
| 21 | 1 |  |  | 1 |  | 5 |  | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 21 |  | 
| 22 |  |  |  |  |  |  | use Avro::Schema; | 
| 23 | 1 |  |  | 1 |  | 374 | use Avro::Protocol; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 24 | 1 |  |  | 1 |  | 5 | use Error; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 20 |  | 
| 25 | 1 |  |  | 1 |  | 5 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 26 |  |  |  |  |  |  | use Object::Tiny qw{ | 
| 27 | 1 |  |  |  |  | 5 | doc | 
| 28 |  |  |  |  |  |  | request | 
| 29 |  |  |  |  |  |  | response | 
| 30 |  |  |  |  |  |  | errors | 
| 31 |  |  |  |  |  |  | }; | 
| 32 | 1 |  |  | 1 |  | 487 |  | 
|  | 1 |  |  |  |  | 261 |  | 
| 33 |  |  |  |  |  |  | our $VERSION = '1.11.1'; | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | my $class = shift; | 
| 36 |  |  |  |  |  |  | my $struct = shift; | 
| 37 | 1 |  |  | 1 | 0 | 2 | my $types = shift; | 
| 38 | 1 |  |  |  |  | 2 |  | 
| 39 | 1 |  |  |  |  | 7 | my $resp_struct = $struct->{response} | 
| 40 |  |  |  |  |  |  | or throw Avro::Protocol::Error::Parse("response is missing"); | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 1 | 50 |  |  |  | 4 | my $req_struct = $struct->{request} | 
| 43 |  |  |  |  |  |  | or throw Avro::Protocol::Error::Parse("request is missing"); | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 1 | 50 |  |  |  | 2 | my $request = [ | 
| 46 |  |  |  |  |  |  | map { Avro::Schema::Field->new($_, $types) } @$req_struct | 
| 47 |  |  |  |  |  |  | ]; | 
| 48 | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 3 |  | 
| 49 |  |  |  |  |  |  | my $err_struct = $struct->{errors}; | 
| 50 |  |  |  |  |  |  |  | 
| 51 | 1 |  |  |  |  | 2 | my $response = Avro::Schema->parse_struct($resp_struct, $types); | 
| 52 |  |  |  |  |  |  | my $errors = $err_struct ? Avro::Schema->parse_struct($err_struct, $types) : undef; | 
| 53 | 1 |  |  |  |  | 3 |  | 
| 54 | 1 | 50 |  |  |  | 4 | return $class->SUPER::new( | 
| 55 |  |  |  |  |  |  | doc      => $struct->{doc}, | 
| 56 |  |  |  |  |  |  | request  => $request, | 
| 57 |  |  |  |  |  |  | response => $response, | 
| 58 | 1 |  |  |  |  | 13 | errors   => $errors, | 
| 59 |  |  |  |  |  |  | ); | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | } | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | 1; |