I realized that while I didn't want to build old versions of perl from source, I could probably peruse the source. So I found the 5.6.0, 5.6.2, and 5.8.0 tarballs at http://www.cpan.org/src/5.0/, and looked for perlfunc.pod in each.

The perlfunc POD for v5.6.0 does list the 3-argument open FILEHANDLE,MODE,LIST, so 3-argument alone isn't enough to make something 5.6-incompatible. Further, "You may use  & after  >,  >>,  <,  +>,  +>>, and  +<", so '<&' obviously existed in 5.6.0. However, "Duping file handles is not yet supported for 3-argument open()", which answers that question.

The perlfunc POD for v5.6.2 says the same. It changes in v5.8.0, the wording changes to "If you use the 3 arg form then you can pass either a number, the name of a filehandle or the normal ''reference to a glob''."

Thus, 3-argument open() for duping of filehandles was introduced in v5.8.0. That's useful information for my Perl::MinimumVersion bug report.

As far as my other question: workarounds: the 5.6.0 POD implies that it will accept filehandle dup with 2-argument version. Thus I think that the following should be a good test case, which I will submit with my bug report, once I've figured out a machine/virtual machine where I can easily install perl 5.6.0 for testing (because I obviously cannot rely on perlver to let me know about 5.6.0 compatibility on these scripts).

#!c:\usr\bin\perl.exe use warnings; use strict; use 5.006; # this is a lie; really, require 5.8.0 for 3-argument open +() to dup STDIN open my $infile, '<',$0 or die "cannot open $0 for read as \$infile: $ +!"; open INFILE, '<', $0 or die "cannot open $0 for read as INFILE: $!" +; open OLDIN, "<&STDIN" or die "cannot dup STDIN to OLDIN: $!"; close STDIN; open STDIN, '<&', $infile or warn "cannot set STDIN = \$infile using + 3-argument open(): $!"; # 3-argument dup is not valid perl 5.6. +0-5.6.2 print "READ FROM STDIN=<&\$infile:\n" . <STDIN> . <STDIN> . $/; close STDIN; close $infile; open STDIN, '<&INFILE' or warn "cannot set STDIN = <&INFILE using + 2-argument open(): $!"; # 2-argument dup should be valid perl 5 +.6.0 print "READ FROM STDIN=<&\$infile:\n" . <STDIN> . <STDIN> . $/; close STDIN; close INFILE; open STDIN, "<&OLDIN" or warn "cannot reset STDIN = <&OLDIN usin +g 2-argument open(): $!"; close OLDIN; print "Input Text to ensure we switched back to original STDIN: "; my $in = <STDIN>; print "READ FROM STDIN:$/$in$/"; exit;

(While debugging that, I learned that I'll have to switch from open($fh, '<&STDIN') to open(FILEHANDLE, '<&STDIN') to be able to use the dup feature.)

And it's perlver output:

C:>perlver perlver_bug.pl --------------------------------------------- | file | explicit | syntax | external | | --------------------------------------------- | | perlver_bug.pl | 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 | --------------------------------------------- C:>perlver --blame perlver_bug.pl ------------------------------------------------------------ File : perlver_bug.pl Line : 2 Char : 1 Rule : _perl_5006_pragmas Version : 5.006 ------------------------------------------------------------ use warnings; ------------------------------------------------------------

As to why it flagged on 46, but not 42: I'm now reasonably confident it's because 42 was a 2-argument open()/dup, whereas 46 was the invalid 3-argument open()/dup.

tl;dr summary

  1. What Perl version introduced open() using '<&'? I know that by 5.8.5, it works, and apparently it doesn't in 5.6.2.
    5.6.0 for 2-argument, 5.8.0 for 3-argument
  2. Should I consider it a bug in Perl::MinimumVersion 1.38 that perlver claimed my test suite was compatible with 5.6.0?
    I am now convinced it's a bug in Perl::MinimumVersion
  3. Should I just skip the portions of my test suite that require the '<&'? Or should I try to find an alternate?
    I will attempt to switch to 2-argument open() for my dups
  4. Is there an easy way to get 5.6.0 on Windows? (Alternately, pre-made virtual machine with 5.6.0?)
    Still open

Anybody have a favorite linux VM (that's easy to run on a Windows host) that already has perl 5.6.0 installed? Or maybe one that's easy to perlbrew? (I've never used perlbrew, but seen it mentioned here.)


In reply to Re: open('<&'), Perl::MinimumVersion, and my test suite by pryrt
in thread open('<&'), Perl::MinimumVersion, and my test suite by pryrt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.