Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Which pragmas are activated with a specific perl version?

by LanX (Saint)
on Mar 15, 2018 at 11:20 UTC ( [id://1210940]=note: print w/replies, xml ) Need Help??


in reply to Which pragmas are activated with a specific perl version?

from perldoc use

use VERSION also lexically enables all features available in the requested version as defined by the feature pragma, disabling any features not in the requested version's feature bundle. See feature . Similarly, if the specified Perl version is greater than or equal to 5.12.0, strictures are enabled lexically as with use strict . Any explicit use of use strict or no strict overrides use VERSION , even if it comes before it. Later use of use VERSION will override all behavior of a previous use VERSION , possibly removing the strict and feature added by use VERSION . use VERSION does not load the feature.pm or strict.pm files.

In perldoc feature each "feature" is listed with the minimal version.

Like

The say feature

use feature say tells the compiler to enable the Perl 6 style say function.

See say for details.

This feature is available starting with Perl 5.10.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Which pragmas are activated with a specific perl version?
by haukex (Archbishop) on Mar 15, 2018 at 13:47 UTC

    And taking the information from "Feature Bundles":

    # no "use VERSION" is the same as: use feature qw/array_base/; use 5.010; # is the same as: use feature qw/say state switch array_base/; use 5.012; # is the same as: use strict; use feature qw/say state switch unicode_strings array_base/; use 5.014; # is the same as: use strict; use feature qw/say state switch unicode_strings array_base/; use 5.016; # is the same as: use strict; use feature qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc/; use 5.018; # is the same as: use strict; use feature qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc/; use 5.020; # is the same as: use strict; use feature qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc/; use 5.022; # is the same as: use strict; use feature qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc/; use 5.024; # is the same as: use strict; use feature qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc postderef_qq/; use 5.026; # is the same as: use strict; use feature qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc postderef_qq/;

    Note the absence of warnings, as already pointed out by Eily.

      Thanks! This answers my question. But I have a new one :-)

      Where did you get this version of the table?

      My perldoc and the web based documentation have a different table:

      The following feature bundles are available: bundle features included --------- ----------------- :default array_base :5.10 say state switch array_base :5.12 say state switch unicode_strings array_base :5.14 say state switch unicode_strings array_base :5.16 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.18 say state switch unicode_strings unicode_eval evalbytes current_sub fc ...
        Where did you get this version of the table?

        I got it from the link I posted (http://perldoc.perl.org/feature.html#FEATURE-BUNDLES), which at the moment is the Perl 5.26.1 documentation. The table you showed has the same entries - I assume you have Perl 5.18 installed, which is why your table doesn't go any further.

        If you want to stay absolutely up-to-date, see the %feature_bundle hash (and the corresponding table near the bottom of the file) in lib/feature.pm in the Perl source repository (Update: or regen/feature.pl). According to that, the features for use 5.028; will be qw/say state switch unicode_strings unicode_eval evalbytes current_sub fc postderef_qq bitwise/ (subject to change, of course).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1210940]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-20 01:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found