perl cpan installation error - perl

I tried installing cpan for strawberry perl with following cpan App::cpanminus.
But following is the error I got. Could you please guide how can I resolve this issue?
C:\Strawberry\perl\bin>cpan app::cpanminus
CPAN: CPAN::SQLite loaded ok (v0.204)
Database was generated on Thu, 02 Apr 2015 07:11:45 GMT
Warning: Cannot install app::cpanminus, don't know what it is.
Try the command
i /app::cpanminus/
to find objects with matching identifiers.
CPAN: Time::HiRes loaded ok (v1.9726)
C:\Strawberry\perl\bin>i /app::cpanminus/
'i' is not recognized as an internal or external command,
operable program or batch file.

To install it without using cpan, the basic bootstrap procedure is:
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
For more information see the installation section at App::cpanminus

Related

cpan says App::cpanminus is up to date but cpanm doesn't come up in /usr/bin

SHORT QUESTION
I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus and then **sudo** /usr/bin/cpan -i App::cpanminus It said App::cpanminus is up to date. but no cpanm is available in /usr/bin or anywhere else.
NOTE I've looked up the questionCan't locate module in #INC but CPAN says module is up to date and some others which seemed related to my case but they didn't help. Not much information is available in Google searches either.
LONG QUESTION
I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus
All the downloading, extracting, compiling, etc went smoothly but at the last step, before installing it as (As Far As I Can Remember / AFAICR) /usr/bin/cpanm it stopped with a permission error (AFAICR) So I've repeated the same line with sudo:
~ $ sudo /usr/bin/cpan -i App::cpanminus
this time it said (again, AFAICR)
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
Database was generated on Thu, 09 Dec 2021 18:17:02 GMT
App::cpanminus is up to date.
and it didn't place the cpanm into /usr/bin or any other PATH directory.
Note that I need to use solely perl, v5.8.8 because it is the only version compatible with some of the system level Perl applications.
When I did a search on the ~/.cpanm and the default Mac OS X Perl installation folder which is /System/Library/Perl no instance of cpanm was found. So I gather cpanm is not created at all.
I've deleted the /Users/Mac/.cpan and repeated the sudo install and it ended up with the same message above (again, AFAICR)
So I got stuck in this. I didn't do anything else other than deleting ~/.cpan
How to install cpan on this Mac ?
Note 2 My question's title might not be best. Anyone is free to edit the title or the question.
Edit 1
I've tried the -f option but it said unknown option f
Here is how it goes:
~ $ sudo /usr/bin/cpan -if App::cpanminus
Unknown option: f
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
^C
~ $ sudo /usr/bin/cpan -f App::cpanminus
Unknown option: f
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
^C
~ $ sudo /usr/bin/cpan -f -i App::cpanminus
Unknown option: f
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
Database was generated on Thu, 09 Dec 2021 18:17:02 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
http://www.cpan.org/authors/01mailrc.txt.gz
Going to read /Users/Mac/.cpan/sources/authors/01mailrc.txt.gz
Fetching with LWP:
http://www.cpan.org/modules/02packages.details.txt.gz
Going to read /Users/Mac/.cpan/sources/modules/02packages.details.txt.gz
Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
There's a new CPAN.pm version (v2.29) available!
[Current version is v1.7602]
You might want to try
install Bundle::CPAN
reload cpan
without quitting the current session. It should be a seamless upgrade
while we are running...
Fetching with LWP:
http://www.cpan.org/modules/03modlist.data.gz
Going to read /Users/Mac/.cpan/sources/modules/03modlist.data.gz
Going to write /Users/Mac/.cpan/Metadata
App::cpanminus is up to date.
And surely enough there's still no cpanm installed.
Edit 2
Output of the cpan -D App::cpanminus (only the meaningful lines included)
Would you like to configure as much as possible automatically? [yes] yes
Reading '/Users/Mac/.cpan/Metadata'
Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
App:cpanminus
-------------------------------------------------------------------------
(no description)
M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz
(no installation file)
Installed: not installed
CPAN: 1.7044 Not up to date
Tatsuhiko Miyagawa (MIYAGAWA)
miyagawa#bulknews.net
A few things to note:
The cpan output should tell you where it installed things. Do you have the output? To try again, you can force install with cpan -f to see what happened.
The .cpan/ directory is just a work directory for CPAN.pm. However, you can go into its build/ directory and find the directory for the thing you are having trouble with to look at its build files. The Makefile will have settings such as INSTALLBIN and INSTALLSITEBIN (and some others) that notes where it decided to install things. Apple has typically set these to whatever they wanted for you already, so it's slightly different than the default perl behavior.
You've likely installed the cpanm script in one of perl's directories. Perl modules typically do not install into a common directory without you doing something special. There's likely a bin directory at the same level as the lib/ directory. See where you installed the module and then look for that bin/
$ cpan -D App::cpanminus
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/brian/.cpan/Metadata'
Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
App::cpanminus
-------------------------------------------------------------------------
(no description)
M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz
/usr/local/perls/perl-5.34.0/lib/site_perl/5.34.0/App/cpanminus.pm
Installed: 1.7044
CPAN: 1.7044 up to date
Tatsuhiko Miyagawa (MIYAGAWA)
miyagawa#bulknews.net
$ ls -l /usr/local/perls/perl-5.34.0/bin/cpanm
-r-xr-xr-x 1 brian wheel 302800 Jun 23 18:53 /usr/local/perls/perl-5.34.0/bin/cpanm
I like to leave the Perl programs in that bin directory and make links to them if I want them somewhere else in my path (Make links to per version tools.
The -i switch to cpan is just extra typing. It's implied in almost every case where you would use it.
You get the permission error because you are using the system Perl and installing things into the directories it set up. Apple is pretty good about segregating that, but I don't remember how well they were doing that back then. A system update (heh, in your case unlikely ;) might overwrite or delete your work. Many people use a separate, user-installed perl and pretend the system perl does not exist.

Perl modules not recognized

I'm trying to run unitas_1.7.8.pl, a bioinformatic software available here. Importantly, I've used this software many times in the past successfully on this ubuntu machine. Now when I run the command
perl ~/scripts/unitas_1.7.0.pl -threads 24 -s homo_sapiens -i PCR_Primer_11_S11_L001_R1_001.trim.lng ...
I get the error
Perl module LWP::Simple is not installed on this machine!
Perl module Archive::Extract (in core since 2007-07-07) is not installed on this machine!
Perl modules are available for download at http://www.cpan.org/
If you have CPAN installed try the following:
cpan
install Archive::Extract
exit
If you are on MAC or UNIX you should run cpan with sudo:
sudo cpan
install Archive::Extract
exit
I've followed those instructions and updated AND reinstalled cpan (even though I know it should be fine) without apparent issues. The only thing I can think of that has changed since the last time I successfully used unitas is that the server was hard-rebooted a month ago.
Details:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
$ cpan --version
Loading internal logger. Log::Log4perl recommended for better logging
/home/user/miniconda3/bin/cpan version 1.64 calling Getopt::Std::getopts (version 1.12 [paranoid]),
running under Perl version 5.30.3.
[Now continuing due to backward compatibility and excessive paranoia.
See 'perldoc Getopt::Std' about $Getopt::Std::STANDARD_HELP_VERSION.]
Nothing to install!
$ type -p perl; perl -M5.010 -e'say "$_: $ENV{$_}" for sort grep /^PERL/, keys(%ENV)'; echo 'o conf' | cpan
/home/stewart/miniconda3/bin/perl
[...]
make [/usr/bin/make]
make_arg []
make_install_arg []
make_install_make_command [/usr/bin/make]
makepl_arg [INSTALLDIRS=site]
mbuild_arg []
mbuild_install_arg []
mbuild_install_build_command [./Build]
mbuildpl_arg [--installdirs site]
[...]
$ perl -MLWP::Simple -E 'say $INC{"LWP/Simple.pm"}'
Can't locate LWP/Simple.pm in #INC (you may need to install the LWP::Simple module) (#INC contains: /home/stewart/miniconda3/lib/site_perl/5.30.3/x86_64-linux-thread-multi /home/stewart/miniconda3/lib/site_perl/5.30.3 /home/stewart/miniconda3/lib/5.30.3/x86_64-linux-thread-multi /home/stewart/miniconda3/lib/5.30.3 .).
BEGIN failed--compilation aborted.
$ head -n 1 "$( type -p cpan )"
#!/home/stewart/miniconda3/bin/perl
$ perl -MLWP::Simple -e'print "ok\n"'
Can't locate LWP/Simple.pm in #INC (you may need to install the LWP::Simple module) (#INC contains: /home/stewart/miniconda3/lib/site_perl/5.30.3/x86_64-linux-thread-multi /home/stewart/miniconda3/lib/site_perl/5.30.3 /home/stewart/miniconda3/lib/5.30.3/x86_64-linux-thread-multi /home/stewart/miniconda3/lib/5.30.3 .).
BEGIN failed--compilation aborted.
current state of LWP::Simple and Archive::Extract
$ sudo cpan install LWP::Simple
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/root/.cpan/Metadata'
Database was generated on Tue, 07 Sep 2021 08:55:47 GMT
LWP::Simple is up to date (6.56).
$ sudo cpan install Archive::Extract
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/root/.cpan/Metadata'
Database was generated on Tue, 07 Sep 2021 08:55:47 GMT
Archive::Extract is up to date (0.88).
$ sudo cpan LWP::Simple
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/root/.cpan/Metadata'
Database was generated on Tue, 07 Sep 2021 08:55:47 GMT
LWP::Simple is up to date (6.56).
If you already have Miniconda, then you should install using the Bioconda channel in an isolated environment. Your Perl installation, from conda, is interfering with your system CPAN modules:
conda create -n unitas -c bioconda unitas
conda activate unitas
unitas.pl -threads 24 -s homo_sapiens -i PCR_Primer_11_S11_L001_R1_001.trim.lng ...
conda deactivate
None of the solutions suggested worked for me except calling perl directly from another directory (which already had it installed).
/usr/bin/perl5.30.0 ~/scripts/unitas_1.7.0.pl ...
There may be a way to switch the default perl used when called to this directory with $PATH, but I found this workaround for now. Thanks all for your help.

DBD::DB2 installation failing because of test using cpan on Strawberry Perl

I am very new to perl and I am trying to install DBD::DB2 module for perl on a windows PC using cpan but I keep getting this error:
CPAN: CPAN::SQLite loaded ok (v0.212)
Database was generated on Thu, 06 Dec 2018 20:55:19 GMT
Running install for module 'DBD::DB2'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.081)
Checksum for D:\STRAWB~1\cpan\sources\authors\id\I\IB\IBMTORDB2\DBD-DB2-1.85.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.32)
CPAN: YAML::XS loaded ok (v0.75)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
Configuring I/IB/IBMTORDB2/DBD-DB2-1.85.tar.gz with Makefile.PL
Configuring DBD::DB2...
Remember to actually read the README and CAVEATS files!
Using DB2 in "D:/SQLLIB"
System: perl5.028001 DBI1.642 Win32 strawberry-perl 5.28.1.1 #1 Sun Dec 2 14:24:00 2018 x64 MSWin32-x64-multi-thread dl_win32.xs
Compiler: gcc -s -O2 -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields
Includes: -I"D:/SQLLIB/include" -I"D:\STRAWB~1\perl\site\lib/auto/DBI" -I"D:\STRAWB~1\perl\lib/auto/DBI" -I"D:\STRAWB~1\perl\vendor\lib/auto/DBI" -I"D:\STRAWB~1\perl\site\lib/auto/DBI"
Libraries: -L"D:/SQLLIB/lib" db2cli.lib db2api.lib
Checking if your kit is complete...
Looks good
Checking if your kit is complete...
Looks good
Writing MYMETA.yml and MYMETA.json
Generating a gmake-style Makefile
Writing Makefile for DBD::DB2
Writing MYMETA.yml and MYMETA.json
IBMTORDB2/DBD-DB2-1.85.tar.gz
D:\Strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for I/IB/IBMTORDB2/DBD-DB2-1.85.tar.gz
CPAN: Module::CoreList loaded ok (v5.20181130)
cp DB2.pm blib\lib\DBD\DB2.pm
cp DB2.pod blib\lib\DBD\DB2.pod
cp lib/Bundle/DBD/DB2.pm blib\lib\Bundle\DBD\DB2.pm
gmake[1]: Entering directory 'D:/STRAWB~1/cpan/build/DBD-DB2-1.85-10/Constants'
AutoSplitting ..\blib\lib\DBD\DB2\Constants.pm (..\blib\lib\auto\DBD\DB2\Constants)
Running Mkbootstrap for Constants ()
"D:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "Constants.bs"
"D:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Constants.bs ..\blib\arch\auto\DBD\DB2\Constants\Constants.bs 644
"D:\Strawberry\perl\bin\perl.exe" "D:\Strawberry\perl\lib\ExtUtils/xsubpp" -typemap D:\STRAWB~1\perl\lib\ExtUtils\typemap Constants.xs > Constants.xsc
"D:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- Constants.xsc Constants.c
gcc -c -I"D:/SQLLIB/include" -I"D:\STRAWB~1\perl\site\lib/auto/DBI" -I"D:\STRAWB~1\perl\lib/auto/DBI" -I"D:\STRAWB~1\perl\vendor\lib/auto/DBI" -I"D:\STRAWB~1\perl\site\lib/auto/DBI" -I"D:/SQLLIB/include" -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.85\" -DXS_VERSION=\"1.85\" "-ID:\STRAWB~1\perl\lib\CORE" - DDB2_CACHE_FIX Constants.c
gmake[1]: Leaving directory 'D:/STRAWB~1/cpan/build/DBD-DB2-1.85-10/Constants'
IBMTORDB2/DBD-DB2-1.85.tar.gz
D:\STRAWB~1\c\bin\gmake.exe -- NOT OK
Stopping: 'install' failed for 'DBD::DB2'.
I tried to copying the DBD::DB2 module form another computer but that did not work and gave me error Can't locate loadable object for module DBD::DB2::Constants in #INC
Any help is appreciated.
According to this technote, IBM India (possibly the maintainers of DBD:DB2) supports DBD:DB2 for Windows with ActiveState Perl. The technote also shows how to use ppm to get the pre-built module.
If you don't care about which Perl supplier , consider using Activestate Perl for Windows. If you must persist with Strawberry Perl, read on.
The current V11.1 Db2-LUW documentation also says in addition to ActiveState Perl, that 32-bit Strawberry-Perl is supported with this statement:
The working versions of Perl that works with Db2 are Activestate Perl
and 32-bit Strawberry Perl. For 32-bit Strawberry Perl specifically,
you must email opendev#us.ibm.com or contact IBM support for the
required binaries.
If you have a support contract for Db2, you might want to check with them if the Db2 documentation is accurate (frequently for non-core stuff, it is inaccurate, out of date, misleading etc), and whether they can issue 64-bit binaries for DBD::DB2.
Looking at the CPAN page for changes to DBD:DB2, seems the most recent change was in 2012. So it is unclear if this module is maintained currently.
On the same site, there is also a reported issue opened in 2013, that DBD:DB2 fails to build with Strawberry perl.
I'm sure that a determined C programmer would be able to resolve the issue...the question is whether there are enough users to bother...
I've found a work around for this, just insert this the following files:
Constants/Constants.xs
DB2.h
#ifndef __DBD_DBI_FIX__
#define __DBD_DBI_FIX__
#include <specstrings.h>
#ifndef __out_ecount_opt
#define __out_ecount_opt SAL__out_ecount_opt
#endif
#ifndef __in_ecount_opt
#define __in_ecount_opt SAL__in_ecount_opt
#endif
#ifndef __out_bcount_opt
#define __out_bcount_opt SAL__out_bcount_opt
#endif
#endif
The full fix is here:
https://github.com/ro-ag/DBD-DB2-1.86/commit/1ad9d4163656d9830fd567caf6d57603045ee392
You may also direct install it from a PPM package I've create for Windows 10:
https://github.com/ro-ag/Perl-64-PPM/raw/master/PPM-64/DBD-DB2.tar.gz
The cpan module is forgotten i've sent several e-mails to IBM to include this fix without success.
Not an anwser but a Question. Your DBD-DB2-tar.gz is missing a PPD file that strawberry perl requires for installation.

how to install GnuPG::Interface perl module on windows?

When I try to do this : cpan install GnuPG::Interface
either on Strawberry or Activeperl ( windows ) I get this error :
I use last perl version available 5.26.1.1
CPAN: File::Temp loaded ok (v0.2304)
CPAN: YAML::XS loaded ok (v0.66)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20170821)
Configuring A/AL/ALEXMV/GnuPG-Interface-0.52.tar.gz with Makefile.PL
which gpg ... 'which' is not recognized as an internal or external command,
operable program or batch file.
gpg (GnuPG) not found at Makefile.PL line 7.
Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=si
te]
ALEXMV/GnuPG-Interface-0.52.tar.gz
C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- NOT OK
Any tip ? Im actually trying to install Mail::GnuPG but GnuPG::Interface is required.
thank you
This line in Makefile.PL:
system("which", "gpg");
die "gpg (GnuPG) not found" if ( $? != 0 );
is attempting to check if gpg exists in your %PATH% but since you do not have the standard *nix utility which, it fails. You can install Perl's App::pwhich and replace that line with system("pwhich", "gpg"); if you want or, if you know that gpg is in your %PATH%, delete that line from Makefile.PL entirely.
Alternatively, you can install Git for Windows which will provide both which and gpg along with perl 5.24.1.
If one were to rewrite this Makefile.PL from scratch, I would recommend using File::Which to check for all locations on your %PATH% where a gpg executable exists.

Installing Perl modules on Ubuntu 16.04

I'm trying to install Perl modules Geo::ShapeFile and Math::Round but I keep coming across the same error and I can't find a solution that works. I've local::lib installed fine but its not being found or something? Am I doing it in the wrong place?
cian#cian-Aspire-5750:~/Documents/Math-Round-0.07$ make install
Manifying 1 pod document
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/man/man3'
mkdir /usr/local/man/man3: Permission denied at /usr/share/perl/5.22/ExtUtils/Install.pm line 477.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
at -e line 1.
Makefile:697: recipe for target 'pure_site_install' failed
make: *** [pure_site_install] Error 13
I notice in my directory '/usr/local/man' points to 'usr/share/man'. I dunno if this was an issue how to solve it. Thanks.
I've local::lib installed fine
No, you don't. The environment has clearly not by set by local::lib. Make sure the following in your login script:
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
(Adjust the path to local::lib if needed.)
Log out and log back in or use the following to pick up the changes:
exec bash -l
If you want to install module systemwide (it's what you do), you should have root privileges. Try sudo make install or install modules locally.
Alternatively you may try a cpanm client, which handles local::lib installs either:
$ cpanm -l ~/ Geo::ShapeFile Math::Round
And then don't forget to adjust perl5lib var to see installed modules:
$ PERL5LIB=~/lib/perl5