I have the need for a lightweight object system in a perl5 script. After reading the documentation for Mouse.pm, Moo.pm and Mo.pm, I was tossing up between Moo and Mo. The deciding factor in the end was that the Mo module has no dependencies (see right-hand side of page - "DEPENDENCIES" is grey out).
So, I go ahead with what I thought would be a simple install:
User#Ubuntu-iMac:~$ perl -MCPAN -e shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.
cpan[1]> Terminal does not support GetHistory.
Lockfile removed.
User#Ubuntu-iMac:~$ sudo perl -MCPAN -e shell
[sudo] password for User:
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.
cpan[1]> install Mo
Reading '/home/User/.cpan/Metadata'
Database was generated on Tue, 23 Feb 2016 02:17:02 GMT
Running install for module 'Mo'
Fetching with LWP:
http://www.cpan.org/authors/id/I/IN/INGY/Mo-0.39.tar.gz
Checksum for /home/User/.cpan/sources/authors/id/I/IN/INGY/Mo-0.39.tar.gz ok
Scanning cache /home/User/.cpan/build for sizes
............................................................................DONE
Configuring I/IN/INGY/Mo-0.39.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Mo
Writing MYMETA.yml and MYMETA.json
INGY/Mo-0.39.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for I/IN/INGY/Mo-0.39.tar.gz
---- Unsatisfied dependencies detected during ----
---- INGY/Mo-0.39.tar.gz ----
Moose [requires,optional]
IO::All [requires,optional]
Mouse [requires,optional]
... many lines of installation of dozens of modules deleted ...
So my question is - why did it think it needed Mouse, IO::All and, most painfull of all, Moose? Note I can see it says [requires,optional] - but I thought those two terms were contradictory.
Related
I am trying to install one of the Perl module in my local system (Windows 7). But its failing to install the module
Here is what its displaying
C:\Windows\system32>perl -MCPAN -e "install Net::SFTP"
Reading 'C:\Users\AppData\Local\.cpan\Metadata'
Database was generated on Sun, 26 May 2019 05:17:03 GMT
Running install for module 'Net::SFTP'
Checksum for C:\Users\AppData\Local\.cpan\sources\authors\id\L\LK\LKINLE
Y\Net-SFTP-0.12.tar.gz ok
Configuring L/LK/LKINLEY/Net-SFTP-0.12.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Math::Int64 0.54 not found.
Warning: prerequisite Net::SSH::Perl 2.12 not found.
The getpwuid function is unimplemented at C:/Perl64/lib/ExtUtils/MakeMaker.pm li
ne 1064.
Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL INSTALL_BASE=~
/perl5]
LKINLEY/Net-SFTP-0.12.tar.gz
C:\Perl64\bin\perl.exe Makefile.PL INSTALL_BASE=~/perl5 -- NOT OK
It was working fine before and I have installed couple of modules, don't know what happens suddenly.
Please help me to resolve this. Do I need to make any modifications in config?
You're telling Perl to into ~/perl5. That's not a Windows path, and ExtUtils::MakeMaker is using a unix-specific function (getpwuid) to expand it. Your problem should go away if you use a Windows path.
That said, if you have access to write to C:\Perl64\..., I suggest that you install modules to the default directory by removing INSTALL_BASE=~/perl5.
If you don't have access to write to C:\Perl64\..., I suggest that you install Perl itself in a directly to which you do have access to write, and then I'd install modules to the default directory by removing INSTALL_BASE=~/perl5.
Since you didn't actually specify INSTALL_BASE=~/perl5 on the command line, you are specifying it through the environment (PERL_MM_OPT and PERL_MB_OPT), or in cpan's configuration (o conf from within cpan).
I think this might be an issue w/ having had Strawberry Perl and Berrybrew on the same system.
I had Strawberry Perl installed, and then installed Berrybrew and uninstalled Strawberry Perl.
At that point Berrybrew on Windows worked for me, but when I try to install CPAN modules it didn't. I get the same type of error for multiple CPAN modules. Below is an example. This is using my 5.26.1_64 install with Berrybrew.
I think it is looking for Strawberry Perl's gmake.
cpan[1]> install Log::Log4perl
Reading 'C:\Users\me\.cpan\Metadata'
Database was generated on Thu, 03 May 2018 13:54:25 GMT
Running install for module 'Log::Log4perl'
Fetching with LWP:
http://www.cpan.org/authors/id/M/MS/MSCHILLI/Log-Log4perl-1.49.tar.gz
Fetching with LWP:
http://www.cpan.org/authors/id/M/MS/MSCHILLI/CHECKSUMS
Checksum for C:\Users\me\.cpan\sources\authors\id\M\MS\MSCHILLI\Log-Log4perl-1.49.tar.gz ok
Scanning cache C:\Users\me\.cpan\build for sizes
............................................................................DONE
Configuring M/MS/MSCHILLI/Log-Log4perl-1.49.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for Log::Log4perl
Writing MYMETA.yml and MYMETA.json
MSCHILLI/Log-Log4perl-1.49.tar.gz
C:\berrybrew\5.26.1_64\perl\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK
Running make for M/MS/MSCHILLI/Log-Log4perl-1.49.tar.gz
The system cannot find the path specified.
MSCHILLI/Log-Log4perl-1.49.tar.gz
C:\Strawberry\c\bin\gmake.EXE -- NOT OK
Failed during this command:
MSCHILLI/Log-Log4perl-1.49.tar.gz : make NO
Then I reinstalled Strawberry Perl on my system, and installing Log::Log4perl worked (installed it for Strawberry Perl, of course). It did fail one test, but I think that's unrelated.
Now that I realized the issue is that it is looking for Strawberry Perl's gmake, I figured maybe it would work now that I have Strawberry Perl again. But now I can't turn Berrybrew on again. I had turned it off with berrybrew off and now I want to turn it on again with this:
> berrybrew use 5.26.1_64
perl-5.26.1_64
==============
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
<berrybrew use 5.26.1_64>: run "exit" leave this environment
That's a pretty strange message. The command does not have an effect.
Any ideas how I can get Berrybrew working again and tell it to use a better version of gmake (not tied to Strawberry Perl)?
Hi I wanted to install a package via cpan, but I get the following error:
cpan[1]> install Log::Log4perl
Reading '/home/paulzierep/.cpan/Metadata'
Database was generated on Fri, 30 Sep 2016 06:29:02 GMT
Running install for module 'Log::Log4perl'
Checksum for /home/paulzierep/.cpan/sources/authors/id/M/MS/MSCHILLI/Log-Log4perl-1.47.tar.gz ok
Scanning cache /home/paulzierep/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring M/MS/MSCHILLI/Log-Log4perl-1.47.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Have /usr/lib/x86_64-linux-gnu/perl/5.22.1
Want /usr/lib/x86_64-linux-gnu/perl/5.22
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [5.22.1]
Config says: [x86_64-linux-gnu-thread-multi]
This may or may not cause problems. Please check your installation of perl
if you have problems building this extension.
Generating a Unix-style Makefile
Writing Makefile for Log::Log4perl
Writing MYMETA.yml and MYMETA.json
MSCHILLI/Log-Log4perl-1.47.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for M/MS/MSCHILLI/Log-Log4perl-1.47.tar.gz
make: *** No rule to make target '/usr/lib/x86_64-linux-gnu/perl/5.22/Config.pm', needed by 'Makefile'. Stop.
MSCHILLI/Log-Log4perl-1.47.tar.gz
/usr/bin/make -- NOT OK
Failed during this command:
MSCHILLI/Log-Log4perl-1.47.tar.gz : make NO
Well it says to check my perl installation, which is:
perl --version
This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
(with 58 registered patches, see perl -V for more detail)
Copyright 1987-2015, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Here's #INC:
/usr/lib/x86_64-linux-gnu/perl/5.22.1/ /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base
That what I get for:
paulzierep#naproxen:~$ perl -E 'say for #INC'
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.22.1
/usr/local/share/perl/5.22.1
/usr/lib/x86_64-linux-gnu/perl5/5.22
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.22
/usr/share/perl/5.22
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base
.
paulzierep#naproxen:/home$ perl -MFile::Spec -E 'say for File::Spec->path'
/home/paulzierep/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
This typically happens when the perl you invoke looks in library directories that other perls left behind. Part of the error is:
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Start investigating there. Find out where it's finding the mismatched Config.pm and fix that issue. Running perl -V to see what's in #INC will help.
Beyond that you'll have to tell us a lot more about your setup.
You've previously mentioned adding a directory to PERL5LIB you shouldn't have added. Please reverse this change and this problem will go away.
You should really take another look at the comments on your previous question
Why does the default cpan on Ubuntu 16.04 give the error "Can't locate B.pm in #INC"?
where I observed that your #INCcontains your home directory /home/paulzierep in the last position
I asked whether the environment variables PERL5LIB or PERL5OPT were set, and your only response says
I changed the PERL5LIB environement var to usr/lib/x86_64-linux-gnu/perl/5.22.1/ and indeed I am able to open the cpan shell, but ones I try an install now, I get: Your perl and your Config.pm seem to have different ideas about the architecture they are running on
I don't know what you have done to get your home directory at the end of #INC. Both PERL5LIB and the -I command-line options use unshift instead of push, and add locations to the start of the #INC array
It's quite possible to build a new perl image with your home directory in #INC by default, but surely you would have said so if that is what you had done?
Let me be clear: PERL5LIB and PERL5OPT should be undefined for normal operation of perl
So after deleting the perl related environment variables I came back to my previous error post cpan command gives the error "Can't locate B.pm in #INC".
Which I managed to solve, so I assume this answers this post then as well.
I'm trying to install Perl module MediaWiki::API using CPAN on OS X:
sudo cpan MediaWiki::API Password:
Reading '/Users/qazwsx/.cpan/Metadata'
Database was generated on Mon, 13 Jul 2015 20:53:32 GMT
Running install for module 'MediaWiki::API'
Running make for E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz
Checksum for /Users/qazwsx/.cpan/sources/authors/id/E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz ok
sh: /opt/local/bin/gzip: No such file or directory
Package seems to come without Makefile.PL.
(The test -f "/Users/qazwsx/.cpan/build/EXOBUZZ-iwzBiH/Makefile.PL" returned false.)
Writing one on our own (setting NAME to MediaWikiAPI)
CPAN.pm: Building E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz
Writing Makefile for MediaWikiAPI
Writing MYMETA.yml and MYMETA.json
EXOBUZZ/MediaWiki-API-0.40.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
No tests defined for MediaWikiAPI extension.
EXOBUZZ/MediaWiki-API-0.40.tar.gz
/usr/bin/make test -- OK
Running make install
Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod
EXOBUZZ/MediaWiki-API-0.40.tar.gz
/usr/bin/make install -- OK
This is a step of installing Git-Mediawiki (see https://github.com/moy/Git-Mediawiki/wiki/User-manual). However, after all the installation steps, the first git command reports that MediaWiki::API module isn't available:
git pull
Can't locate MediaWiki/API.pm in #INC (you may need to install the MediaWiki::API module) (#INC contains: /Users/qazwsx/WorkSpace-X4430/git/perl /Users/qazwsx/WorkSpace-X4430/git/contrib/mw-to-git /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.
I wonder if my installation method for the Perl module is correct. One thing strikes out as odd is the error
sh: /opt/local/bin/gzip: No such file or directory
I use Homebrew with standard paths, so the gzip binary is at /usr/local/bin/gzip. But I don't know if or where to fix it. It appears to be some search paths issue but I don't know how to fix it.
There might be something wrong with your ~/.cpan, the configuration for CPAN. You can try
# Re-install cpan
brew doctor
brew update
brew install cpan
# Remove or back up ~/.cpan
mv ~/.cpan ~/.cpan.bak
# Re-initialize ~/.cpan
cpan config
# Try installing the Perl module again
sudo cpan install MediaWiki::API
UPDATE:
One difference I found was that Data::Show uses Module::Build, while Data::Dumper uses a Build file (using vimdiff):
I've noticed that with cpan and cpanm, some modules are not reinstalled when there isn't a newer version, but others are reinstalled every time. I don't have anything in my PERL5LIB variable and my #INC includes all the right paths. I am using perlbrew, but I think that I had similar problems using a custom-built perl:
%ENV:
PERLBREW_BASHRC_VERSION="0.73"
PERLBREW_HOME="/home/username/.perlbrew"
PERLBREW_MANPATH="/home/username/perl5/perlbrew/perls/perl-5.20.1/man"
PERLBREW_PATH="/home/username/perl5/perlbrew/bin:/home/user/perl5/perlbrew/perls/perl-5.20.1/bin"
PERLBREW_PERL="perl-5.20.1"
PERLBREW_ROOT="/home/username/perl5/perlbrew"
PERLBREW_VERSION="0.73"
PERLDEV="/share/data/username/Perl5"
#INC:
/home/username/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux
/home/username/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1
/home/username/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux
/home/username/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1
Data::Dumper doesn't get reinstalled when there isn't a newer version:
cpanm Data::Dumper
Data::Dumper is up to date. (2.154)
However, Data::Show gets reinstalled every time:
$ cpanm Data::Show
--> Working on Data::Show
Fetching http://www.cpan.org/authors/id/D/DC/DCONWAY/Data-Show-0.002002.tar.gz ... OK
Configuring Data-Show-0.002002 ... OK
Building and testing Data-Show-0.002002 ... OK
Successfully installed Data-Show-0.002002
1 distribution installed
$ cpanm Data::Show
--> Working on Data::Show
Fetching http://www.cpan.org/authors/id/D/DC/DCONWAY/Data-Show-0.002002.tar.gz ... OK
Configuring Data-Show-0.002002 ... OK
Building and testing Data-Show-0.002002 ... OK
Successfully installed Data-Show-0.002002
1 distribution installed
Results of cpanm -v Data::Show
cpanm (App::cpanminus) 1.7027 on perl 5.020001 built for x86_64-linux
Work directory is /home/username/.cpanm/work/1424150236.20375
You have make /usr/bin/make
You have LWP 6.13
You have /bin/tar: tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching Data::Show on cpanmetadb ...
--> Working on Data::Show
Fetching http://www.cpan.org/authors/id/D/DC/DCONWAY/Data-Show-0.002002.tar.gz ... OK
Unpacking Data-Show-0.002002.tar.gz
Data-Show-0.002002/
Data-Show-0.002002/Build.PL
Data-Show-0.002002/Changes
Data-Show-0.002002/lib/
Data-Show-0.002002/Makefile.PL
Data-Show-0.002002/MANIFEST
Data-Show-0.002002/META.yml
Data-Show-0.002002/README
Data-Show-0.002002/t/
Data-Show-0.002002/t/00.load.t
Data-Show-0.002002/t/pod.t
Data-Show-0.002002/t/show.t
Data-Show-0.002002/lib/Data/
Data-Show-0.002002/lib/Data/Show.pm
Entering Data-Show-0.002002
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.98)
Running Build.PL
Configuring Data-Show-0.002002 ... Module::Build will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at Build.PL, line 3.
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Data-Show' version '0.002002'
OK
Checking dependencies from MYMETA.json ...
Checking if you have version 0 ... Yes (0.9909)
Checking if you have Data::Dump 1.17 ... Yes (1.22)
Checking if you have Test::More 0 ... Yes (1.001014)
Building and testing Data-Show-0.002002 ... Module::Build will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at ./Build, line 40.
Building Data-Show
Module::Build will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at ./Build, line 40.
t/00.load.t .. 1/1 # Testing Data::Show 0.002002
t/00.load.t .. ok
t/pod.t ...... skipped: Test::Pod 1.14 required for testing POD
t/show.t ..... Smartmatch is experimental at t/show.t line 28.
t/show.t ..... ok
All tests successful.
Files=3, Tests=64, 1 wallclock secs ( 0.06 usr 0.02 sys + 0.12 cusr 0.03 csys = 0.23 CPU)
Result: PASS
Module::Build will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at ./Build, line 40.
Building Data-Show
OK
Successfully installed Data-Show-0.002002
Installing /home/username/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux/.meta/Data-Show-0.002002/install.json
1 distribution installed
Very interestingly, they are not both installing to a place that perldoc can see:
$ perldoc -l Data::Dump
/home/username/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/Data/Dump.pm
$ perldoc -l Data::Show
No documentation found for "Data::Show".
It looks like my problem was that Build.PL files are not working for some reason. When I saw that Data::Show comes with both a Build.PL file and a Makefile.PL, I tried installing it manually using the Makefile and then it installed:
perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Data::Show
Writing MYMETA.yml and MYMETA.json
$ make
cp lib/Data/Show.pm blib/lib/Data/Show.pm
Manifying blib/man3/Data::Show.3
$ make install
Installing /home/username/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/Data/Show.pm
Installing /home/username/perl5/perlbrew/perls/perl-5.20.1/man/man3/Data::Show.3
Appending installation info to /home/username/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux/perllocal.pod
$ cpanm Data::Show
Data::Show is up to date. (0.002002)