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

Re: use feature

Thread Previous | Thread Next
David Golden
February 21, 2011 13:33
Re: use feature
Message ID:
On Mon, Feb 21, 2011 at 3:04 PM, Zefram <> 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 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 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About