#43741: cpan fails to install any module -----------------------------+-------------------------------- Reporter: me@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: perl5 perl5.16 | -----------------------------+-------------------------------- Comment (by devans@…): Then you probably need to run cpan with sudo. The following works for me. {{{ sudo port install perl5 }}} which gives {{{ $ which perl cpan /opt/local/bin/perl /opt/local/bin/cpan $ perl -v This is perl 5, version 22, subversion 1 (v5.22.1) built for darwin- thread-multi-2level ... $ cpan -v /opt/local/bin/cpan script version 1.63, CPAN.pm version 2.11 }}} so I won't bother with the 5.22 suffix stuff. If I then run {{{ sudo cpan }}} I can install whatever I like and it gets installed into the perl5.22 site path {{{ /opt/local/lib/perl5/site_perl/5.22 }}} MacPorts modules install into the vendor path {{{ /opt/local/lib/perl5/vendor_perl/5.22 }}} and core modules are in the main path {{{ /opt/local/lib/perl5/5.22 }}} So CPAN, MacPorts and CPAN can all have the same module installed without conflict Looking at @INC {{{ perl -e "print join(\"\n\", @INC), \"\n\"" /opt/local/lib/perl5/site_perl/5.22/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.22 /opt/local/lib/perl5/vendor_perl/5.22/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.22 /opt/local/lib/perl5/5.22/darwin-thread-multi-2level /opt/local/lib/perl5/5.22 . }}} you can see, from the search order, that MacPort's vendor installed modules will override core, but CPAN's site installed modules will override MacPort's. So if you have all three installed CPAN wins. Using the very useful [https://raw.githubusercontent.com/mklement0/whichpm/stable/bin/whichpm whichpm script], if I install Net::FTP, which is a core module, using both MacPorts and CPAN I see {{{ $ whichpm Net::FTP whichpm: WARNING: DUPLICATE module files found for 'Net::FTP': /opt/local/lib/perl5/vendor_perl/5.22/Net/FTP.pm (from p5-net) /opt/local/lib/perl5/5.22/Net/FTP.pm (from core) /opt/local/lib/perl5/site_perl/5.22/Net/FTP.pm (from cpan) }}} the last one is the version that perl will load due to the @INC search order. -- Ticket URL: <https://trac.macports.org/ticket/43741#comment:10> MacPorts <https://www.macports.org/> Ports system for OS X