diff --git a/.github/workflows/test-lang-perl-ARM.yml b/.github/workflows/test-lang-perl-ARM.yml index f115645adf7..a7d3576cbdf 100644 --- a/.github/workflows/test-lang-perl-ARM.yml +++ b/.github/workflows/test-lang-perl-ARM.yml @@ -49,29 +49,19 @@ jobs: - name: Install Dependencies run: | - sudo apt-get -qqy install --no-install-recommends libjansson-dev \ - libcompress-raw-zlib-perl \ - libcpan-uploader-perl \ - libencode-perl \ - libio-string-perl \ - libjson-xs-perl \ - libmodule-install-perl \ - libmodule-install-readmefrompod-perl \ - libobject-tiny-perl \ - libperl-critic-perl \ - libsnappy-dev \ - libtest-exception-perl \ - libtest-pod-perl cpanm --mirror https://www.cpan.org/ install Compress::Zstd \ + Encode \ Error::Simple \ - Module::Install::Repository \ - Regexp::Common \ - Try::Tiny \ - inc::Module::Install \ + JSON::MaybeXS \ + Module::Install \ Module::Install::ReadmeFromPod \ + Object::Tiny \ + Perl::Critic \ + Regexp::Common \ Test::Exception \ - IO::String \ - Object::Tiny + Test::More \ + Test::Pod \ + Try::Tiny - name: Lint run: ./build.sh lint @@ -95,25 +85,22 @@ jobs: - name: Install Dependencies run: | - sudo apt-get -qqy install --no-install-recommends libcompress-raw-zlib-perl \ - libcpan-uploader-perl \ - libencode-perl \ - libio-string-perl \ - libjansson-dev \ - libjson-xs-perl \ - libmodule-install-perl \ - libmodule-install-readmefrompod-perl \ - libobject-tiny-perl \ - libsnappy-dev \ - libtest-exception-perl \ - libtest-pod-perl - cpanm --mirror https://www.cpan.org/ install Compress::Zstd \ + sudo apt-get -qqy install --no-install-recommends libjansson-dev \ + libsnappy-dev + cpanm --mirror https://www.cpan.org/ install CPAN::Uploader \ + Compress::Zstd \ + Encode \ Error::Simple \ - Module::Install::Repository \ + JSON::MaybeXS \ + Module::Install \ + Module::Install::ReadmeFromPod \ Object::Tiny \ + Perl::Critic \ Regexp::Common \ - Try::Tiny \ - inc::Module::Install + Test::Exception \ + Test::More \ + Test::Pod \ + Try::Tiny - name: Cache Local Maven Repository uses: actions/cache@v4 diff --git a/.github/workflows/test-lang-perl.yml b/.github/workflows/test-lang-perl.yml index c9022129796..44e4105a2a5 100644 --- a/.github/workflows/test-lang-perl.yml +++ b/.github/workflows/test-lang-perl.yml @@ -49,29 +49,19 @@ jobs: - name: Install Dependencies run: | - sudo apt-get -qqy install --no-install-recommends libjansson-dev \ - libcompress-raw-zlib-perl \ - libcpan-uploader-perl \ - libencode-perl \ - libio-string-perl \ - libjson-xs-perl \ - libmodule-install-perl \ - libmodule-install-readmefrompod-perl \ - libobject-tiny-perl \ - libperl-critic-perl \ - libsnappy-dev \ - libtest-exception-perl \ - libtest-pod-perl cpanm --mirror https://www.cpan.org/ install Compress::Zstd \ + Encode \ Error::Simple \ - Module::Install::Repository \ - Regexp::Common \ - Try::Tiny \ - inc::Module::Install \ + JSON::MaybeXS \ + Module::Install \ Module::Install::ReadmeFromPod \ + Object::Tiny \ + Perl::Critic \ + Regexp::Common \ Test::Exception \ - IO::String \ - Object::Tiny + Test::More \ + Test::Pod \ + Try::Tiny - name: Lint run: ./build.sh lint @@ -95,25 +85,21 @@ jobs: - name: Install Dependencies run: | - sudo apt-get -qqy install --no-install-recommends libcompress-raw-zlib-perl \ - libcpan-uploader-perl \ - libencode-perl \ - libio-string-perl \ - libjansson-dev \ - libjson-xs-perl \ - libmodule-install-perl \ - libmodule-install-readmefrompod-perl \ - libobject-tiny-perl \ - libsnappy-dev \ - libtest-exception-perl \ - libtest-pod-perl - cpanm --mirror https://www.cpan.org/ install Compress::Zstd \ + sudo apt-get -qqy install --no-install-recommends libjansson-dev \ + libsnappy-dev + cpanm --mirror https://www.cpan.org/ install CPAN::Uploader \ + Compress::Zstd \ + Encode \ Error::Simple \ - Module::Install::Repository \ + JSON::MaybeXS \ + Module::Install \ + Module::Install::ReadmeFromPod \ Object::Tiny \ Regexp::Common \ - Try::Tiny \ - inc::Module::Install + Test::Exception \ + Test::More \ + Test::Pod \ + Try::Tiny - name: Cache Local Maven Repository uses: actions/cache@v4 diff --git a/BUILD.md b/BUILD.md index f9c601681f8..e19b8340db8 100644 --- a/BUILD.md +++ b/BUILD.md @@ -15,8 +15,8 @@ The following packages must be installed before Avro can be built: - Perl: Perl 5.24.1 or greater, gmake, Module::Install, Module::Install::ReadmeFromPod, Module::Install::Repository, Math::BigInt, JSON::MaybeXS, Try::Tiny, Regexp::Common, Encode, - IO::String, Object::Tiny, Compress::ZLib, Error::Simple, - Test::More, Test::Exception, Test::Pod + Object::Tiny, Compress::ZLib, Error::Simple, Test::More, + Test::Exception, Test::Pod - Rust: rustc and Cargo 1.65.0 or greater - Apache Ant 1.7 - md5sum, sha1sum, used by top-level dist target diff --git a/lang/perl/Changes b/lang/perl/Changes index 2d4e6c3d5c5..83cb2342ff8 100644 --- a/lang/perl/Changes +++ b/lang/perl/Changes @@ -2,6 +2,8 @@ Revision history for Perl extension Avro - Switch from JSON::XS to JSON::MaybeXS to support multiple JSON backends + - Drop dependency on IO::String, since we don't need + it now we depend on Perl 5.10.1 or greater 1.00 Fri Jan 17 15:00:00 2014 - Relicense under apache license 2.0 diff --git a/lang/perl/MANIFEST b/lang/perl/MANIFEST index d308e85ea01..0674514797f 100644 --- a/lang/perl/MANIFEST +++ b/lang/perl/MANIFEST @@ -25,7 +25,6 @@ inc/Module/Install/Makefile.pm inc/Module/Install/MakeMaker.pm inc/Module/Install/Metadata.pm inc/Module/Install/ReadmeFromPod.pm -inc/Module/Install/Repository.pm lib/Avro.pm lib/Avro/BinaryDecoder.pm lib/Avro/BinaryEncoder.pm diff --git a/lang/perl/Makefile.PL b/lang/perl/Makefile.PL index b5b0a33ddc8..5da5e215423 100644 --- a/lang/perl/Makefile.PL +++ b/lang/perl/Makefile.PL @@ -24,17 +24,26 @@ chomp $version; license 'apache'; version $version; +homepage 'http://avro.apache.org/'; +repository { + type => 'git', + url => 'git://git.apache.org/avro.git', + web => 'http://github.com/apache/avro', +}; +bugtracker { web => 'http://issues.apache.org/jira/browse/AVRO/' }; readme_from 'lib/Avro.pm'; all_from 'lib/Avro.pm'; -build_requires 'Test::More', 0.88; +configure_requires 'Module::Install'; +configure_requires 'Module::Install::ReadmeFromPod'; test_requires 'Math::BigInt'; test_requires 'Perl::Critic'; test_requires 'Test::Exception'; +test_requires 'Test::More', 0.88; +test_requires 'Test::Pod'; requires 'Compress::Zlib'; requires 'Compress::Zstd'; requires 'Encode'; requires 'Error::Simple'; -requires 'IO::String'; requires 'JSON::MaybeXS'; requires 'Object::Tiny'; requires 'Regexp::Common'; @@ -43,7 +52,6 @@ requires 'parent'; unless ($Config{use64bitint}) { requires 'Math::BigInt'; } -auto_set_repository(); my %packages = ( 'Avro' => 'lib/Avro.pm', diff --git a/lang/perl/lib/Avro/BinaryDecoder.pm b/lang/perl/lib/Avro/BinaryDecoder.pm index 55732279052..d2bb65e14f7 100644 --- a/lang/perl/lib/Avro/BinaryDecoder.pm +++ b/lang/perl/lib/Avro/BinaryDecoder.pm @@ -49,9 +49,9 @@ The schema we want to use to decode the data. =item * reader -An object implementing a straightforward interface. C and -C are expected. Typically a IO::String object or a -IO::File object. It is expected that this calls will block the decoder, if not +A file handle, or an object implementing a similar interface, like L. +Specifically, it must support C and +C. These calls will block the decoder if not enough data is available for read. =back diff --git a/lang/perl/t/03_bin_decode.t b/lang/perl/t/03_bin_decode.t index c9fde32c109..e5da35d9983 100644 --- a/lang/perl/t/03_bin_decode.t +++ b/lang/perl/t/03_bin_decode.t @@ -23,7 +23,6 @@ use Avro::Schema; use Avro::BinaryEncoder; use Test::More; use Test::Exception; -use IO::String; use_ok 'Avro::BinaryDecoder'; @@ -31,7 +30,7 @@ use_ok 'Avro::BinaryDecoder'; { my $enc = "\x06\x66\x6f\x6f"; my $schema = Avro::Schema->parse(q({ "type": "string" })); - my $reader = IO::String->new($enc); + open my $reader, '<', \$enc or die "Can't open memory file: $!"; my $dec = Avro::BinaryDecoder->decode( writer_schema => $schema, reader_schema => $schema, @@ -49,7 +48,7 @@ use_ok 'Avro::BinaryDecoder'; ] } EOJ - $reader = IO::String->new("\x36\x06\x66\x6f\x6f"); + open $reader, '<', \"\x36\x06\x66\x6f\x6f" or die "Can't open memory file: $!"; $dec = Avro::BinaryDecoder->decode( writer_schema => $schema, reader_schema => $schema, @@ -58,7 +57,7 @@ EOJ is_deeply $dec, { a => 27, b => 'foo' }, "Binary_Encodings.Complex_Types.Records"; - $reader = IO::String->new("\x04\x06\x36\x00"); + open $reader, '<', \"\x04\x06\x36\x00" or die "Can't open memory file: $!"; $schema = Avro::Schema->parse(q({"type": "array", "items": "long"})); $dec = Avro::BinaryDecoder->decode( writer_schema => $schema, @@ -67,7 +66,7 @@ EOJ ); is_deeply $dec, [3, 27], "Binary_Encodings.Complex_Types.Arrays"; - $reader = IO::String->new("\x02"); + open $reader, '<', \"\x02" or die "Can't open memory file: $!"; $schema = Avro::Schema->parse(q(["string","null"])); $dec = Avro::BinaryDecoder->decode( writer_schema => $schema, @@ -76,7 +75,7 @@ EOJ ); is $dec, undef, "Binary_Encodings.Complex_Types.Unions-null"; - $reader = IO::String->new("\x00\x02\x61"); + open $reader, '<', \"\x00\x02\x61" or die "Can't open memory file: $!"; $dec = Avro::BinaryDecoder->decode( writer_schema => $schema, reader_schema => $schema, @@ -102,10 +101,11 @@ EOP data => $data, emit_cb => sub { $enc = ${ $_[0] } }, ); + open my $reader, '<', \$enc or die "Cannot open memory file: $!"; my $dec = Avro::BinaryDecoder->decode( writer_schema => $w_enum, reader_schema => $r_enum, - reader => IO::String->new($enc), + reader => $reader, ); is $dec, $data, "decoded!"; } @@ -116,10 +116,11 @@ EOP data => $data, emit_cb => sub { $enc = ${ $_[0] } }, ); + open my $reader, '<', \$enc or die "Cannot open memory file: $!"; throws_ok { Avro::BinaryDecoder->decode( writer_schema => $w_enum, reader_schema => $r_enum, - reader => IO::String->new($enc), + reader => $reader, )} "Avro::Schema::Error::Mismatch", "schema problem"; } } @@ -147,10 +148,11 @@ EOJ data => $data, emit_cb => sub { $enc .= ${ $_[0] } }, ); + open my $reader, '<', \$enc or die "Cannot open memory file: $!"; my $dec = Avro::BinaryDecoder->decode( writer_schema => $w_schema, reader_schema => $r_schema, - reader => IO::String->new($enc), + reader => $reader, ); is $dec->{a}, 1, "easy"; ok ! exists $dec->{bonus}, "bonus extra field ignored"; @@ -158,11 +160,12 @@ EOJ ## delete the default for t delete $r_schema->fields->[0]{default}; + open $reader, '<', \$enc or die "Cannot open memory file: $!"; throws_ok { Avro::BinaryDecoder->decode( writer_schema => $w_schema, reader_schema => $r_schema, - reader => IO::String->new($enc), + reader => $reader, ); } "Avro::Schema::Error::Mismatch", "no default value!"; } @@ -182,10 +185,11 @@ EOP data => $data, emit_cb => sub { $enc .= ${ $_[0] } }, ); + open my $reader, '<', \$enc or die "Cannot open memory file: $!"; my $dec = Avro::BinaryDecoder->decode( writer_schema => $w_schema, reader_schema => $r_schema, - reader => IO::String->new($enc), + reader => $reader, ); is_deeply $dec, $data, "decoded!"; @@ -207,18 +211,20 @@ EOP data => $data, emit_cb => sub { $enc .= ${ $_[0] } }, ); + open my $reader, '<', \$enc or die "Cannot open memory file: $!"; throws_ok { Avro::BinaryDecoder->decode( writer_schema => $w_schema, reader_schema => $r_schema, - reader => IO::String->new($enc), + reader => $reader, ) } "Avro::Schema::Error::Mismatch", "recursively... fails"; + open $reader, '<', \$enc or die "Cannot open memory file: $!"; my $dec = Avro::BinaryDecoder->decode( writer_schema => $w_schema, reader_schema => $w_schema, - reader => IO::String->new($enc), + reader => $reader, ); is_deeply $dec, $data, "decoded succeeded!"; } @@ -239,10 +245,11 @@ EOP data => $data, emit_cb => sub { $enc .= ${ $_[0] } }, ); + open my $reader, '<', \$enc or die "Cannot open memory file: $!"; my $dec = Avro::BinaryDecoder->decode( writer_schema => $w_schema, reader_schema => $w_schema, - reader => IO::String->new($enc), + reader => $reader, ); is_deeply $dec, $data, "decoded succeeded! +upgrade"; is $dec->{one}[0], 1.0, "kind of dumb test";