hesco has asked for the wisdom of the Perl Monks concerning the following question:

Refactoring a 2006 perl cgi application (based on a 1999 php application) as a Mojolicious app, with the Moose having been introduced by earlier development, I have just in the last dozen commits begun to introduce Mojo to the mix. After a handful of successful tests with a Mojo::Lite app, as I make the transition to a non-Lite app, on my way to supporting the legacy features, I seem plagued by errors looking like this:

List::Util version 1.45 required--this is only version 1.38 at local/l +ib/perl5/x86_64-linux-gnu-thread-multi/Moose/ line 9. BEGIN failed--compilation aborted at local/lib/perl5/x86_64-linux-gnu- +thread-multi/Moose/ line 9. Compilation failed in require at local/lib/perl5/x86_64-linux-gnu-thre +ad-multi/ line 15. BEGIN failed--compilation aborted at local/lib/perl5/x86_64-linux-gnu- +thread-multi/ line 15. Compilation failed in require at /opt/local/vote/vagrant/cf_vote/bin/. +./lib/ line 5. BEGIN failed--compilation aborted at /opt/local/vote/vagrant/cf_vote/b +in/../lib/ line 5. Compilation failed in require at (eval 12) line 1.

having tried a number of strategies, the latest looking like that in the next code block. The grep in the BEGIN block was motivated by an inspection of `Dumper \@INC;` and `locate List/ | grep -v \.cpanm | xargs grep -i our.*version.*1.38` queries.

#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib", "$FindBin::Bin/../local/lib/pe +rl5", "$FindBin::Bin/../lib/perl5"; @INC = grep { $_ !~ /perl\/5.20.2/ } @INC; } print Dumper \@INC; my $listen_socket = '3000'; my $watch_paths = [ 'lib', 'templates', 'app', '/opt/local/vote' ]; # Start command line interface for application require Mojolicious::Commands; Mojolicious::Commands->start_app('Vote','daemon','-l',"http://*:$liste +n_socket");

the resulting @INC is as expected, excluding the problematic version of List::Util.

$VAR1 = [ '/opt/local/vote/vagrant/cf_vote/bin/../lib', '/opt/local/vote/vagrant/cf_vote/bin/../local/lib/perl5', '/opt/local/vote/vagrant/cf_vote/bin/../lib/perl5', '/etc/perl', '/usr/lib/x86_64-linux-gnu/perl5/5.20', '/usr/share/perl5', '/usr/lib/x86_64-linux-gnu/perl/5.20', '/usr/share/perl/5.20', '/usr/local/lib/site_perl', '.' ];

Running that same locate-xrgs-grep query for version 1.49, shows me:
which should be served by the second entry in my @INC array:

line 5 of reads `use Moose;` and its context looks like this:

package Vote; use lib qw( lib local/lib/perl5 ); use CGI; use Moose; use MooseX::NonMoose; extends 'Mojolicious::Controller'; use Mojolicious::Plugin::CGI;

The line blowing up in reads: `use Moose::Exporter;', and its context looks like this:

use strict; use warnings; package Moose; # git description: 2.2008-4-gf9468cd8f our $VERSION = '2.2009'; our $AUTHORITY = 'cpan:STEVAN'; use 5.008003; use Scalar::Util (); use Carp 'carp'; use Module::Runtime 'module_notional_filename'; use Class::Load 'is_class_loaded'; use Moose::Deprecated; use Moose::Exporter; use Class::MOP;

And the problematic Moose::Exporter line reads `use List::Util 1.45 qw( uniq );`, in a context of this:

package Moose::Exporter; our $VERSION = '2.2009'; use strict; use warnings; use Class::Load qw(is_class_loaded); use Class::MOP; use List::Util 1.45 qw( uniq ); use Moose::Util::MetaRole; use Scalar::Util 1.11 qw(reftype); use Sub::Exporter 0.980; use Sub::Name qw(subname);

I'm thinking that the v1.49 installed from a cpanfile entry reading: `requires 'List::Util', '1.49';`, ought to satisfy the 1.45 version requirement created by the Exporter, and do not know why the cpanfile libraries in local/lib/perl5 are not read in precedence over any other available libraries in the @INC stack.

What please might I be missing here?

-- Hugh 
if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }