Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: how to improve: use MODULE VERSION LIST

by choroba (Archbishop)
on Jan 07, 2017 at 22:40 UTC ( #1179147=note: print w/replies, xml ) Need Help??


in reply to Re^2: how to improve: use MODULE VERSION LIST
in thread how to improve: use MODULE VERSION LIST

> Unfortunately, when compiling Perl with the otherlibdirs option (to include additional locations), it adds the new locations to the end of @INC.

Prepending the locations to @INC wouldn't help, as the RTB folks wouldn't be able to load the old version anymore. When searching for a module, Perl checks the version only when it finds the first implementation. If the version is less than the one specified, Perl dies, it doesn't look for a different version in the rest of the paths.

$ cat My.pm package My; our $VERSION = "1"; warn "1 loaded"; 1; $ cat 0/My.pm package My; our $VERSION = "2"; warn "2 loaded"; 1; $ perl -I. -I0 -e 'use My 1; warn $My::VERSION;' 1 loaded at My.pm line 2. 1 at -e line 1. $ perl -I0 -I. -e 'use My 1; warn $My::VERSION;' 2 loaded at 0/My.pm line 2. 2 at -e line 1. $ perl -I. -I0 -e 'use My 2; warn $My::VERSION;' 1 loaded at My.pm line 2. My version 2 required--this is only version 1 at -e line 1. BEGIN failed--compilation aborted at -e line 1. $?=255 $ perl -I0 -I. -e 'use My 2; warn $My::VERSION;' 2 loaded at 0/My.pm line 2. 2 at -e line 1. $ perl -I0 -I. -e 'use My 1; warn $My::VERSION;' 2 loaded at 0/My.pm line 2. 2 at -e line 1.

But, interestingly

$ perl -I. -I0 -e 'eval q{use My 2}; warn $My::VERSION;' 1 loaded at My.pm line 2. 1 at -e line 1.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-08-04 03:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (41 votes). Check out past polls.

    Notices?