Subject: | TieHashDelta.pm uses perl 5.14-specific "each" invocation |
Module-CoreList 2.71 fails to build with perl < 5.14 due to the use of
"each" with a hash reference in TieHashDelta.pm:
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Type of arg 1 to each must be hash or array (not hash element) at
/builddir/build/BUILD/Module-CoreList-2.71/blib/lib/Module/CoreList/TieHashDelta.pm
line 71, near "};"
Compilation failed in require at
/builddir/build/BUILD/Module-CoreList-2.71/blib/lib/Module/CoreList.pm
line 5.
BEGIN failed--compilation aborted at
/builddir/build/BUILD/Module-CoreList-2.71/blib/lib/Module/CoreList.pm
line 5.
Compilation failed in require at t/corelist.t line 3.
BEGIN failed--compilation aborted at t/corelist.t line 3.
t/corelist.t ......
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
The documentation for "each" refers to this usage as being experimental:
Starting with Perl 5.14, each can take a scalar EXPR, which must hold
reference to an unblessed hash or array. The argument will be
dereferenced automatically. This aspect of each is considered highly
experimental. The exact behaviour may change in a future version of Perl.
...
To avoid confusing would-be users of your code who are running earlier
versions of Perl with mysterious syntax errors, put this sort of thing
at the top of your file to signal that your code will work only on Perls
of a recent vintage:
use 5.012; # so keys/values/each work on arrays
use 5.014; # so keys/values/each work on scalars (experimental)