Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: using local $] = 5.008004;

by Anonymous Monk
on Aug 21, 2013 at 03:34 UTC ( #1050276=note: print w/ replies, xml ) Need Help??


in reply to using local $] = 5.008004;

Should we use this to get rid of perl -c errors ?

No

or is there a better way... Here is an example use case for the same:

Well, they don't try to redefine perl version. They detect a version nobody supports anymore, and disable a feature -- no faking perl version

So, I'm not sure why you'd want to redefine $] and it doesn't seem like a solution to anything


Comment on Re: using local $] = 5.008004;
Re^2: using local $] = 5.008004;
by tobyink (Abbot) on Aug 21, 2013 at 11:01 UTC

    "Well, they don't try to redefine perl version. They detect a version nobody supports anymore, and disable a feature -- no faking perl version"

    I don't think kamal is claiming that the code posted does redefine the Perl version. I think he means that if you load DBIx::Class::Carp like this:

    BEGIN { local $] = 5.008004; require DBIx::Class::Carp; DBIx::Class::Carp->import; };

    ... you can trick DBIx::Class::Carp into thinking it's running on an older Perl version.

    And no, I wouldn't recommend doing that, because it'll be fragile. DBIx::Class::Carp is loaded in multiple places, it's only the version from the first time it's loaded that takes effect.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2015-07-07 07:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls