Is there a way to have two versions of the same Perl library in parallel?

I would like to migrate the perl library (SOAP :: Lite) used by my application. In order to switch to end users as smoothly as possible, I would like for two versions of this library (old and new) to work in parallel.

The goal is for end users to be able to migrate their scripts themselves (if necessary) whenever they want. Therefore, mainly for old scripts, users had nothing to change, and new scripts were recorded using the new version.

Does anyone know a way to continue?

+5
source share
2 answers

Since, as you mentioned in the comments, each script is invoked by a Java application that requests as a scheduler, you do not need both modules β€œat once”. Instead, you just need one or the other for each script run. This can be handled by setting up the environment accordingly when an old or new script is called.

You can use solutions like Perlbrew to manage two or more completely different Perl installations if you want. This would be a good approach if you find that you need other differences between the old and new versions.

However, if you just want to change the versions of this single module, all you have to do is both install and change the module path when you call the script. There are various ways to do this, but you can simply use the command line switch :

perl -Idirectory script.pl 

This will add the directory to @INC , a set of locations where modules are searched. If necessary, specify the old or new module (if you do so, make sure that no version of the module is in the standard path to the module, otherwise there will be uncertainty about the version you are using).

+1
source

Use only .

+1
source

Source: https://habr.com/ru/post/1233335/


All Articles