Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions perl/lib/Voxgig/Plugin/Types.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ use strict;
use warnings;
use B ();
use Scalar::Util qw(blessed reftype);

# PERL 5.36 OR LATER, SAID ONCE, HERE.
#
# `builtin` is core from 5.36 and does not exist before it, so on 5.34 the
# interpreter reports `Can't locate builtin.pm` and then unwinds through a
# BEGIN failure for every module on the way down — eight of them when the
# library is loaded through a host — naming each file and never the
# requirement. The README states the minimum; nothing in the code did, so
# the one person who most needs to be told reads the least useful message.
#
# This is the file that depends on it: `is_bool` is the only way perl can
# tell a true boolean from the number 1, and `jsontype` below is the whole
# of the port's answer to having no JSON types.
#
# A BEGIN block rather than `use v5.36`, which would also switch on that
# release's feature bundle and change how the rest of this file compiles.
BEGIN {
if ($] < 5.036) {
die "Voxgig::Plugin::Types requires perl 5.36 or later (this is $]):"
. " it uses builtin::is_bool, the only way perl can tell a true"
. " boolean from the number 1.\n";
}
}

use builtin qw(is_bool);
no warnings 'experimental::builtin';

Expand Down
14 changes: 14 additions & 0 deletions perl/test/Corpus.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ use File::Basename qw(dirname);
use File::Spec;
use JSON::PP ();
use B ();

# PERL 5.36 OR LATER, for the same `builtin::is_bool` the library needs and
# for the same reason — see Voxgig::Plugin::Types, which carries the full
# note. Stated again here because this file loads `builtin` BEFORE it loads
# the library, so on 5.34 the runner would reach the cryptic
# `Can't locate builtin.pm` first and the library's own message never.
BEGIN {
if ($] < 5.036) {
die "the perl corpus runner requires perl 5.36 or later"
. " (this is $]): it uses builtin::is_bool, the only way perl"
. " can tell a true boolean from the number 1.\n";
}
}

use builtin qw(is_bool);
no warnings 'experimental::builtin';
use Voxgig::Plugin qw(codeof);
Expand Down
Loading