pryrt has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monks, when I released Games::Literati 0.032, I discovered the hard way (thanks, CPAN Testers) that in-memory files are not compatible with Perl 5.6. The module itself doesn't use in-memory files, but part of my test suite did. So I reworked the test suite to not use in-memory files. I then found Perl::MinimumVersion 1.38, and ran perlver on my module and test files, and all claimed to be Perl 5.6.0 compatible. However, when I released Games::Literati 0.040, I was surprised to see CPAN Testers flag me for failure when tested under Perl 5.6.2. :-(
CPAN Testers error message: Unknown open() mode '<&' at t/03_input_processing.t line 46.
Specifically, line 46 refers to:
open STDIN, '<&', $fh or do { warn "set STDIN = \$fh=\\$fh: $!"; return undef; };
(I find it strange that it flagged on line 46, because line 42 has similar code
...which seems to be using the same feature. So why did it flag on 46, but not 42?)open my $oldin, "<&STDIN" or do { warn "dup STDIN to \$fh=\\$fh: $!"; return undef; };
(full source: https://metacpan.org/source/PETERCJ/Games-Literati-0.04/t/03_input_processing.t)
perlver output:
C:>perlver t\03_input_processing.t ------------------------------------------------------ | file | explicit | syntax | external | | ------------------------------------------------------ | | t\03_input_processing.t | v5.6.0 | v5.6.0 | n/a | | ------------------------------------------------------ | | Minimum explicit version : v5.6.0 | | Minimum syntax version : v5.6.0 | | Minimum version of perl : v5.6.0 | ------------------------------------------------------
Before I send a bug report to Perl::MinimumVersion for not catching that apparent incompatibility with 5.6.2, I did some more searching, and found open() with more than two arguments. Reading that, it seems to indicate that 5.6.1 was the first to include 3-argument open(). Did I read that correctly? If so, am I correct in concluding that's a separate bug in perlver()? ie, that it should have flagged 3-argument open as requiring 5.6.1?
I couldn't find the perldelta that indicated when '<&' open mode was introduced. I tried looking specifically for an archive of the Perl 5.6 perldocs, but my google-foo isn't that good, apparently. And I don't have access to Perl 5.6.* to look at the docs directly. (I'm mostly on Windows, and Strawberry Perl doesn't go back that far, and ActivePerl only allows older versions for Business or Enterprise Editions. I have access to a machine at $work that has 5.8.5, which is how I know it works by then. But while doing a quick run of a perl script during my coffee break is forgivable, installing a whole old version of perl on that server, even if I did a local installation, would be highly frowned upon, and I enjoy my $paycheck.) So is there a Monk who knows or can easily point me to when '<&' was introduced? I'd like to have 'proof' to supply during my '<&' bug report, but cannot find it, aside from my anecdotal evidence from the CPAN Testers 5.6.2 failure.
Also, more importantly, how do I solve this problem in my test suite? For now, the redirection is only used because the function it's testing gets its input from STDIN, and for the test suite, I wanted to provide input to that function to test it :-). But the redirection isn't used in the module itself, so it's 5.6-compatible. Should I figure out a workaround for the test suite? If so, I desire recommendations from my fellow Monks as to a 5.6-compatible method of testing that function. Or should I just plan skip_all => "Cannot redirect STDIN in perl $]" if $] lt '5.008';?
(Historical note: I'm reluctant to claim that the module requires something higher than 5.6, when it's just the test suite that requires it. That seems rude, especially since the original module that I inherited apparently worked under 5.6, and nothing I've done to improve the module should change that. Why be rude to a Scrabble/Literati player from the early 2000s who doesn't feel the need to upgrade perl just to optimize points, who wants bug fixes and/or to include Words with Friends scoring now?)
Finally, is there any easy way to get a copy of 5.6.0 for Windows? Or is there a small, easy to install linux virtual machine that has 5.6.0 pre-installed?
UPDATE: fix typos
UPDATE: add <readmore>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open('<&'), Perl::MinimumVersion, and my test suite
by pryrt (Abbot) on Apr 05, 2016 at 22:19 UTC | |
|
Re: open('<&'), Perl::MinimumVersion, and my test suite
by RonW (Parson) on Apr 06, 2016 at 17:38 UTC |