in reply to Re: win32 shebang
in thread win32 shebang

Um, please don't do "use 5.6.0;" as that doesn't work quite right in versions of Perl prior to v5.6. Do "use 5.006;" instead.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: win32 shebang
by John M. Dlugosz (Monsignor) on Aug 09, 2001 at 03:03 UTC
    So what does it do?

    My guess is that it will parse it as the float 5.6 and ignore the rest. That will be compared against the internal 5.005 and it will tell you (correctly) that it's not good enough.

      Since when does Perl just ignore things? (: It gets parsed as "5.6" . "0". Yes, it happens to produce the somewhat correct result of telling you that you need to use something like version "5.60", which could certainly be confusing. Sorry, I don't have 5.005 handy to get the exact message and 5.004 doesn't support the "use VERSION" (nor "require VERSION") syntax.

      I also think it is important to make people aware that they need to use "old-style" version numbers in the one part of their code that is only meant to be useful in old versions of Perl. The very similar "use v5.6.0;" is going to produce an even less obvious error message.

      But I also realize that it is more important to put the line in than it is to get it exactly right. At least having an error message that points to that particular line will be more helpful than the other likely failure modes. (Besides, just as far back as 5.004, there is no great way to automatically tell the user that they need to upgrade.)

              - tye (but my friends call me "Tye")
        Since when does Perl just ignore things? (: It gets parsed as "5.6" . "0"
        Since I tried it and that's what happens? ato[id] will read as many chars as makes sence and ignores the rest. E.g.
        sub I_want_a_number ($) { my $val= shift; print $val, " produces ", 0+$val, "\n"; } I_want_a_number ("29 balloons"); I_want_a_number ("5.6.0");
        So, you say that using floats with 3-digit convention in the require statement (did it support use also, or just require, when first introduced?) e.g.require 5.006_001; will have the advantage of giving a reasonable message as far back as 5.005, but still give an unrelated message (file not found) for older. I wonder if the error message can be improved by a "spot change" in UNIVERSAL.pm, for those who can't/won't upgrade? When did the ability to have a sub on the @INC list show up? That can recognise the number for a module name and do the check itself!