in reply to how to improve: use MODULE VERSION LIST

You could:

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: how to improve: use MODULE VERSION LIST
by ikegami (Patriarch) on Jan 09, 2017 at 14:23 UTC

    That's not true. In order to determine the version of a module, Perl must first load it. As such, Perl can't load anything but the first module of a given name it find, even if a version if specified.

    $ cat Foo/Mod.pm package Mod; $VERSION = 1; 1; $ cat Bar/Mod.pm package Mod; $VERSION = 2; 1; $ perl -e'use lib qw( Foo Bar ); use Mod 2;' Mod version 2 required--this is only version 1 at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Re^2: how to improve: use MODULE VERSION LIST
by smile4me (Beadle) on Jan 07, 2017 at 19:03 UTC

    Thanks 1nickt.

    Yeah, I have been coaching folks to do the use lib 'new dir' technique, to rearrange @INC. Which works okay when used in combination with "use autodie 2.29".

    What bothers me most is that I have to manipulate @INC at all, especially when specifying a VERSION that I'm looking to use. The real problem is that Perl will not keep looking for the newer version of a module, if an older one is found earlier in the @INC list of locations.

    Smile,
    Steve

      That's not how it should be working.

      If you have a newer version of a module in a directory that you add with use lib, that should be the one loaded, without need of a version number (so long as that's the last change you make to @INC).

      You should be able to do:

      $ perl -Mautodie -E 'say $autodie::VERSION' 2.23 $ perl -I/usr/foss/packages/foss-perllib -Mautodie -E 'say $autodie::V +ERSION' 2.29


      The way forward always starts with a minimal test.

      As I mentioned in my previous post, I think it would be better to have separate installations of Perl, each with the required set modules of the required versions, with a development installation that is kept up to date. When a new application moves to production, make a new installation of Perl for it and install the modules it needs. this way, each application can have the version of Perl and whatever modules it needs, without worrying about the needs of other applications.