Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: how to import::into v5.020

by Corion (Patriarch)
on Nov 15, 2023 at 20:24 UTC ( [id://11155646]=note: print w/replies, xml ) Need Help??


in reply to how to import::into v5.020

Maybe feature does what you want?

feature->import::into($caller, 'v5.020');

Replies are listed 'Best First'.
Re^2: how to import::into v5.020
by M4 (Novice) on Nov 15, 2023 at 21:15 UTC
    Thanks!
    feature->import::into($caller, ':5.20.0');
    Does the trick!

      Not quite.

      use v5.20;

      is closer to

      BEGIN { require v5.20; } no feature qw( :all ); # `use v5.10;`+ use feature qw( :5.20 ); # `use v5.10;`+ use strict; # `use v5.12;`+ #use warnings; # `use v5.35;`+

      So you want

      require v5.20; feature->unimport::out_of( $caller, ':all' ); # `use v5.10;`+ feature->import::into( $caller, ':5.20' ); # `use v5.10;`+ strict->import::into( $caller ); # `use v5.12;`+ #warnings->import::into( $caller ); # `use v5.35;`+

      Turning off all features first is especially important with 5.35+ because use v5.35; and higher turn off features which are enabled by default. Specifically,

      • use v5.35; and higher turns off the indirect and multidimensional normally-enabled features, and
      • use v5.37; and higher turns off the bareword_filehandles normally-enabled feature
      $ perl -e'use v5.35; abc def;' Bareword found where operator expected (Do you need to predeclare "abc +"?) at -e line 1, near "abc def" syntax error at -e line 1, near "abc def" Execution of -e aborted due to compilation errors. $ perl -e'use feature qw( :5.35 ); abc def;' Can't locate object method "abc" via package "def" (perhaps you forgot + to load "def"?) at -e line 1. $ perl -e'no feature qw( :all ); use feature qw( :5.35 ); abc def;' Bareword found where operator expected (Do you need to predeclare "abc +"?) at -e line 1, near "abc def" syntax error at -e line 1, near "abc def" Execution of -e aborted due to compilation errors.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2025-07-13 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.