I am looking for a way for a module (or script) to be able to load a specific version of a module (mainly by looking at internal modules if the solution does not work with CPAN modules that are OK).
I would prefer this to be basically a packaging exercise (e.g. npm / nodejs works). My code determines the version of the module that he wants, and then when this happens, the correct version of the module is loaded.
If this cannot be done at the packaging level, is there a reasonable way to handle this in code? I really don't want to mask a module (or USE-er module) with
if($api_ver eq '1.1'){ }
elsif($ap_ver eq '2.0') { }
In general, I'm trying to come up with a reasonable way to track module version API versions.
I reviewed onlyfor this post How can I use the “specific version of the CPAN perl module ? , but the unit test report is pretty bad and the module was not affected after 6 years, as far as I can tell (still on my list to play with it)
Edit: In essence, I ask if different modules in my application can use different versions of the same module. Sort of:
Module A
load version 1.0.1 of Module Foo
Module B
load version 2.1.0 of Module Foo
Module A and B are part of the larger software, and module Foo is also written locally (as I said, CPAN versions are less of a concern to me). I would like the API to break the changes to the Foo module without having to raise each module that uses it. Yes, in the end, version 1 of the Foo module may end up obsolete, and the code should be raised at this time.