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,