in reply to Compile time problem

I'm sorry, but I don't quite understand what your real goal is here. Do you intend to open the output file only if the perl version is > 5.007, otherwise don't open the output file?

If so, I'm not sure that the benefit of using a lexically scoped file handle is worth the hassle if the code still has to run on older perl versions. Do you have some compelling reason for needing to use a lexically scoped file handle?

OTOH, if the goal is "open the file this way if perl is > 5.007 and open it the old way otherwise", that would be a really bad idea, because then you'd have to check the version and use eval every time you write to the file handle. Don't do that.

UPDATE: Apologies again... I just noticed this bit:

(Changing the open call to a 2 argument form is not a viable solution :-)

This seems to answer my first question -- no way you would want to open the file if running under an older version (which does not support 3-arg open). Perhaps you could elaborate on why a 2-arg open is not viable, and how that relates to the need to run under older versions of perl.

last update: D'oh!! why didn't I notice "\$var" the first time?! Still, I'm curious why you would add this in a script that is supposed to run under older versions...

Replies are listed 'Best First'.
Re^2: Compile time problem
by syphilis (Archbishop) on Oct 07, 2007 at 10:38 UTC
    I'm curious why you would add this in a script that is supposed to run under older versions

    It's all to do with the FileHandle::Fmode test suite. The module should work ok with perl 5.00505, but offers additional features for later builds of perl. The test suite needs to test the additional features on recent builds of perl - but to not test those features on ancient builds of perl (where such tests break perl).

    Cheers,
    Rob