Subject: | Minimal Scalar::Util version gets set from current version |
The META.* files list 1.32 as a Scalar::Util minimal required version. I wondered why the version changed since older Object-InsideOut release.
The reason is the Makefile.PL injects version of Scalar::Util which presents on the host creating the distributed tar archive:
WriteMakefile(
'PREREQ_PM' => {
'Scalar::Util' => $Scalar::Util::VERSION,
}
);
This construction is used due to previous manual check:
# Check for Scalar::Util::weaken()
eval { require Scalar::Util; };
if ($@) {
# Not found - require minimum version
$Scalar::Util::VERSION = 1.23;
} elsif (! Scalar::Util->can('weaken')) {
# Scalar::Util is 'pure Perl' version
if ($Scalar::Util::VERSION ge '1.20') {
die <<_NO_WEAKEN_;
You must reinstall Scalar::Util in order to install Object::InsideOut
because the currently installed Scalar::Util is a 'pure perl' version
that is missing the 'weaken()' function.
_NO_WEAKEN_
}
$Scalar::Util::VERSION = 1.23;
}
The code has the problem it does not set $Scalar::Util::VERSION if Scalar::Util with weaken is installed. I propose to extend the code with final branch:
elseif {
$Scalar::Util::VERSION = 1.23;
}