Perl v5.40 deprecates and warns about mismatching `use VERSION'
statements until v5.44, at which point it'll become fatal and
unsupported. Multiple `package' statements in the same file are
considered the same scope by Perl, including string `eval' where
packages are declared within the string.
Furthermore, downgrading from v5.11+ to earlier versions is
already fatal in v5.42, at least. It's explained somewhat
unsatisfactorily in perl5360delta(1)...
It appears Perl takes another step towards the path of Python
and Ruby of introducing incompatibilities for minor reasons :<
Reported-by: Kyle Meyer <kyle@kyleam.com>
Link: https://public-inbox.org/meta/87bjmawncx.fsf@kyleam.com/
# There are also API changes to simplify our usage and data set.
package PublicInbox::Git;
use strict;
-use v5.10.1;
+use v5.10.1; # TODO: check unicode_strings compat
use parent qw(Exporter PublicInbox::DS);
use PublicInbox::DS qw(now);
use autodie qw(socketpair sysread sysseek truncate);
}
package PublicInbox::GitCheck; # only for git <2.36
-use v5.12;
+use v5.10.1; # TODO: change PublicInbox::Git to v5.12
our @ISA = qw(PublicInbox::Git);
no warnings 'once';
$pkg =~ s/([a-z])([a-z0-9]+)(\.t)?\z/\U$1\E$2/;
$pkg .= "_T" if $3;
$pkg =~ tr/-.//d;
+ my $tmpdir = tmpdir;
+ my $pl = "$tmpdir/$pkg.pl";
$pkg = "PublicInbox::TestScript::$pkg";
- eval <<EOF;
+ require PublicInbox::IO;
+ PublicInbox::IO::write_file('>', $pl, <<EOF);
package $pkg;
use strict;
use subs qw(exit);
}
1;
EOF
- die "E: $f failed: $@" if $@;
+ # `require' on a file gives us a new scope which
+ # `eval' can't, so we do that to ensure we don't have
+ # conflicting `use VERSION' statements which become fatal
+ # in Perl v5.44 :<
+ require $pl;
$pkg->can('main');
}
}