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

后端 未结 3 1968
甜味超标
甜味超标 2021-01-01 14:06

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 feat

3条回答
  •  醉梦人生
    2021-01-01 14:15

    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);
    }
    

提交回复
热议问题