Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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(); }

In reply to Mojolicious fails to respect @INC by hesco

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (3)
    As of 2019-10-21 00:00 GMT
    Find Nodes?
      Voting Booth?