in reply to Don't use 5.6.N

Instead, use one of these:
require 5.006; # run-time BEGIN { require 5.006; } # compile-ti­me

I agree except for your comments. Instead you should only use:

require 5.006; # reason 5.006 is _required_

(with or without the BEGIN block).

There was (I hope it isn't still the case) a helper tool for creating modules that just stuffed in "require $];" into your module. This was a horrid idea.

"require 5.006;" does not mean "I haven't bothered to test with versions prior to Perl 5.006 and so can't guarantee that it works there". It means "I have tested on perls prior to 5.006 and can say for sure that this module fails on those versions" (well, it means at least the last half of that).

So, either leave off the "require 5.006" or add documentation about what you found (or just know) that doesn't work on such versions. Leaving it off isn't such a bad thing. The errors that result are usually pretty clear and tell you more than just "your Perl is too old", they highlight which new feature your old version of Perl doesn't support.

But, most importantly, don't add "require 5.006" (or whatever version of Perl) unless you actually know that such a version is really required.

- tye        

Replies are listed 'Best First'.
Re^2: Don't use 5.6.N (why)
by dragonchild (Archbishop) on Oct 17, 2007 at 17:03 UTC
    I would disagree with this. I feel that saying "use 5.006;" when you haven't tested with older Perls means "I am only willing to support 5.006 or higher". I had a big internal debate about this with DBM::Deep and decided that I simply didn't have the time to worry about 5.005_03 and the like. So, I put it in and that freed me up to use features that are 5.006+ with impunity (such as 3-arg open, warnings, our, and the like). This was a deliberate choice that was based on non-code-related factors.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

      No, "use 5.006;" doesn't say much of anything. Do you have some reason you only want to document your reasons in this obscure node that nobody will find? You've said you already have a code template, so just add a comment to your template.

      Update: I don't see how you are disagreeing with me. You do know that your module doesn't work with 5.006 and you even know why it doesn't (as well as why you chose that route). Unless you are disagreeing that such information should be given to your module's users.

      - tye        

        I think you misunderstood me. I could've made dbm-deep work with 5.0.0, if I'd really wanted to. But, I didn't want to work harder on backwards-compatibility than I was working on features. I have enough problems maintaining OS-compatibility, as it is. So, I chose to put a hard-demarcation in. I could've easily chosen 5.008 instead of 5.006.

        Once that demarcation was chosen, that freed up certain features for use. But, the line wasn't chosen for the features - it was chosen for the personal sanity. And, "use 5.006;" says exactly what it needs to say "This software is only going to work with this version or higher".

        Now, granted, this discussion is starting me down the road of "I need to document the why behind this assertion in the POD" and I now will. Sometimes, my good friend, you make me think too much! :-)


        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?