develooper Front page | perl.perl5.porters | Postings from February 2011

Re: use feature

Thread Previous | Thread Next
From:
David Golden
Date:
February 21, 2011 13:33
Subject:
Re: use feature
Message ID:
AANLkTi=AeiYCoe8GDWqPMg=tv7xzx2N7+K5y_GTpyNEa@mail.gmail.com
On Mon, Feb 21, 2011 at 3:04 PM, Zefram <zefram@fysh.org> wrote:
> Tom Christiansen wrote:
>>Is there any meaninful difference between writing "use <VERSION>"
>>and writing "use feature ':<VERSION>'" ?

Note that the specification of "VERSION" is different in the two cases
(and variations):

use feature ':5.10';
use v5.10;
use 5.010;
use 5.10.0;
use v5.10.0;

In hindsight, I wish feature.pm hadn't introduced *another* possible
way to specify a perl version.

> Yes, the former does other things too:
>
> * check that the core version is at least that specified (as opposed to
>  merely being able to provide the named feature set)

This is a subtle point related to failure.  On an older perl, "use
feature ..." will die with "Can't locate feature.pm in @INC..."
whereas "use 5.010" will die with "Perl v5.10.0 required--this is only
...".

I think the latter is less confusing to users.

-- David

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About