Question

I updated a CPAN-Module (the old one I used was 2 years old) and after that my software got a problem with the new one. Because it is in productive state I installed the old version again and all was fine. But I need some functions from the new available module for new software-features.

So ... Is it possible to have both version of one module active and adress them in a way (e.g. with the version) in perl??

Because it is something about network I can not try the new module on a new computer because of firewalls that only allow the one productive server to access the remote computer.

Thanks for help! Chris

Was it helpful?

Solution

Perl 6 has the ability to load multiple versions of the same module side-by-side, and use them as desired. But as you've not specified a Perl version, I shall assume 5.x.

The answer is no. You can certainly install them both (using something like local::lib to put them in different library directories), but you cannot use them both in the same process, because they'll stomp on each others' namespaces.

One solution might be to install the new version, download a copy of the old version, and go through the source carefully to rename it so that it has a completely different name, say, Foo::Bar -> Foo::Bar::Compat. Then you can load and use both because they'll have different names.

OTHER TIPS

It's not possible to do what you want in Perl 5.

The best solution is to install the new version of the module on your test server, run your test suite and fix the problems that the new version of module reveals.

If you don't have a test server or a test suite then you shouldn't be doing any maintenance on your production application until you have both of these things set up.

If there is anything preventing you from setting up a test server and a writing a test suite then my best advice is to find yourself a new job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top