Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl: What exact features does 'use 5.014' enable?

Tags:

What exactly does 'use 5.014' enable?

Please, someone copy&paste here, because i was not able find it in any perldoc. (maybe i'm blind). In the 'perldoc feature' are only some things for the 5.10. Or point me to some URL.

thanx.

EDIT:

Please first check, what do you reply. For example: try this:

use 5.008; $s=1; say "hello"; 

You will get error message about the "say", because perl 5.8 doesn't know "say"

after, try this:

use 5.014; $s=1; say "hello"; 

you will get error

Global symbol "$s" requires explicit package name  

so, the "use 5.014" enabling use strict, and use feature 'say'; - by default.

like image 497
jm666 Avatar asked Jun 20 '11 11:06

jm666


2 Answers

Besides what raj correctly said about the error messages you'd receive if using use 5.014 with an older version of Perl, you can find a list of features enabled reading the source code of feature. The relevant part is near the top:

my %feature_bundle = (     "5.10" => [qw(switch say state)],     "5.11" => [qw(switch say state unicode_strings)],     "5.12" => [qw(switch say state unicode_strings)],     "5.13" => [qw(switch say state unicode_strings)],     "5.14" => [qw(switch say state unicode_strings)], ); 

The strict bit part is buried somewhat deeper in the code for the interpreter itself. If you look into pp_ctl.c for tag v5.11.0:

/* If a version >= 5.11.0 is requested, strictures are on by default! */  if (PL_compcv && vcmp(sv, sv_2mortal(upg_version(newSVnv(5.011000), FALSE))) >= 0) {     PL_hints |= (HINT_STRICT_REFS | HINT_STRICT_SUBS | HINT_STRICT_VARS); } 
like image 120
larsen Avatar answered Oct 20 '22 01:10

larsen


In newer Perls (starting with 5.10 I think) use 5.x does an implicit use feature ':5.x' Reading through the perldeltas for 5.12 & 5.14, I see a unicode-related feature added in 5.12, but it appears nothing new was added in 5.14.

like image 39
Sherm Pendley Avatar answered Oct 20 '22 00:10

Sherm Pendley