From 072b51fb548c35fee192917ef1d3cdbd944ef53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Joaqu=C3=ADn=20Atria?= Date: Wed, 12 Jun 2024 14:38:04 +0100 Subject: [PATCH] AVRO-3999 - Avoid warnings in Perl test suite (#2953) * Add error message when schema do not match in Perl When the schema did not match in a call to Avro::BinaryDecoder::decode, a Avro::Schema::Error::Mismatch error was thrown without a body. This was generating a warning when trying to stringify an undefined value, and resulted in the empty string being used as the error message, which was not veryb informative. This change adds a message which should solve both issues. * Do not exit sub via next in Perl tests This silences a loud warning in xt/schema.t --- lang/perl/lib/Avro/BinaryDecoder.pm | 2 +- lang/perl/xt/schema.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/perl/lib/Avro/BinaryDecoder.pm b/lang/perl/lib/Avro/BinaryDecoder.pm index fa12fcf0710..55732279052 100644 --- a/lang/perl/lib/Avro/BinaryDecoder.pm +++ b/lang/perl/lib/Avro/BinaryDecoder.pm @@ -67,7 +67,7 @@ sub decode { my $type = Avro::Schema->match( writer => $writer_schema, reader => $reader_schema, - ) or throw Avro::Schema::Error::Mismatch; + ) or throw Avro::Schema::Error::Mismatch 'schema do not match'; my $meth = "decode_$type"; return $class->$meth($writer_schema, $reader_schema, $reader); diff --git a/lang/perl/xt/schema.t b/lang/perl/xt/schema.t index 5225ce455c2..06792b28de0 100644 --- a/lang/perl/xt/schema.t +++ b/lang/perl/xt/schema.t @@ -23,7 +23,7 @@ use File::Find; use_ok 'Avro::Schema'; sub parse { - next unless /\.avsc$/; + return unless /\.avsc$/; open(my $fh, '<', $_); local $/ = undef; my $schema = <$fh>;