This question already has answers here:
How do I tell CPAN to install all dependencies?
(10 answers)
Closed 5 years ago.
I am trying to run build a Perl project. When I try perl Build.PL, I get an error:
Can't locate Module/Build.pm in #INC
I installed CPAN and tried cpan Module::Build. However when I do that I get an error: Can't locate Module/Metadata.pm in #INC
I tried installing metadata but tests are failing. Is there a way to install Build.pm and all its dependencies at one go
If you want to install a module with dependencies you need to set the following in cpan:
cpan> o conf prerequisites_policy 'follow'
cpan> o conf build_requires_install_policy yes
cpan> o conf commit
Related
I'm new to perl, but, I'm just trying to install it on my windows 10 machine, because, I need to use a NAGIOS plugin named check_logfiles. A perl script/app.
while I am installing Strawberry Perl, I need additional Modules. I invoked CPAN to install more modules and it fails because it finds the GIT Perl CPAN.
how ( can I ) can Perl be installed and this Perl installation is selected instead of the GIT perl? I don't know if I can de-install GIT's Perl ?
ERROR
Trying with
/c/bin/wget.EXE -O "/c/Users/212555427/.cpan/sources/authors/01mailrc.txt.gz.tmp7712"
to get
http://www.cpan.org/authors/01mailrc.txt.gz
--14:42:06-- http://www.cpan.org/authors/01mailrc.txt.gz
=> `C:/Users/212555427/.cpan/sources/authors/01mailrc.txt.gz.tmp7712'
Resolving www.cpan.org... failed: Host not found.
This /c/Users/212555427/.cpan is the GIT installation
I install Strawberry Perl under default C:\Strawberry
$ which perl
/usr/bin/perl
$ where perl
C:\Strawberry\perl\bin\perl.exe
C:\Program Files\Git\usr\bin\perl.exe
$ where cpan
C:\Strawberry\perl\bin\cpan
C:\Strawberry\perl\bin\cpan.bat
C:\Program Files\Git\usr\bin\core_perl\cpan
$ cpan Date::Manip.pm
WARNING: your version of App::Cpan is 1.63_01 while we would expect at least 1.64 at /c/Strawberry/perl/bin/cpan line 11.
Loading internal null logger. Install Log::Log4perl for logging messages
Fetching with LWP:
http://www.cpan.org/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to www.cpan.org:80]
Trying with
/c/bin/wget.EXE -O "/c/Users/212555427/.cpan/sources/authors/01mailrc.txt.gz.tmp22892"
to get
http://www.cpan.org/authors/01mailrc.txt.gz
thank you - please let me know if I need to provide anything else to resolve issue.
I am not a perl expert (see this page), but for using a package, I have to run some perl commands. The command shows this error
$ perl Build.PL
Can't locate Module/Build.pm in #INC (#INC contains: /home/mahmood/src/bioperl-1.6.1 /home/mahmood/src/ensembl/modules
/home/mahmood/src/ensembl-compara/modules /home/mahmood/src/ensembl-variation/modules
/home/mahmood/src/ensembl-funcgen/modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Build.PL line 20.
BEGIN failed--compilation aborted at Build.PL line 20.
I see this reply which offers running cpan Module::Build first to fix that error. As I run that command, I see a bunch of questions (text wizard) which asks me a mirror url. Then it interactively asks my permission to install the packages. It seems that default answers to the questions has such effect. I also, didn't find which question is responsible for that. Please see the full output at pastebin.
Is there any way to automatically install the module, so that I can put that in a script for future things.
UPDATE:
It seems that I have to enter the cpan.org url however in my previous attempt, I used mirror websites. I tried the three commands proposed in the reply, but still get the same error:
Please enter the URL of your CPAN mirror http://www.cpan.org
Configuration does not allow connecting to the internet.
Current set of CPAN URLs:
http://www.cpan.org
Enter another URL or RETURN to quit: []
New urllist
http://www.cpan.org
Please remember to call 'o conf commit' to make the config permanent!
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.
cpan[1]> o conf build_requires_install_policy yes
build_requires_install_policy [yes]
Please use 'o conf commit' to make the config permanent!
cpan[2]> o conf prerequisites_policy follow
prerequisites_policy [follow]
Please use 'o conf commit' to make the config permanent!
cpan[3]> o conf commit
commit: wrote '/home/mahmood/.cpan/CPAN/MyConfig.pm'
cpan[4]> quit
No history written (no histfile specified).
Lockfile removed.
mahmood#cluster:Bio-DB-HTS$ perl Build.PL
Can't locate Module/Build.pm in #INC (#INC contains: /home/mahmood/src/bioperl-1.6.1 /home/mahmood/src/ensembl/modules /home/mahmood/src/ensembl-compara/modules /home/mahmood/src/ensembl-variation/modules /home/mahmood/src/ensembl-funcgen/modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Build.PL line 20.
BEGIN failed--compilation aborted at Build.PL line 20.
If you want to install Module::Build into your system libraries, then it's probably far easier to use the pre-built package that is almost certainly available for your system.
If you're using a RedHat-like Linux distribution, try:
$ sudo yum install perl-Module-Build
(Try dnf instead of yum on newer versions of Fedora.)
If you're using a Debian-like Linux distribution, try:
$ sudo apt-get install libmodule-build-perl
Now that you've got cpan configured, you can change the configuration to bypass asking you to install each dependency.
On the command line (note the o characters are literal... they are not points):
cpan
o conf build_requires_install_policy yes
o conf prerequisites_policy follow
o conf commit
To see a description of each item before entering your response manually:
cpan
o conf init build_requires_install_policy
When a module declares another one as a 'build_requires' prerequisite
this means that the other module is only needed for building or
testing the module but need not be installed permanently. In this case
you may wish to install that other module nonetheless or just keep it
in the 'build_dir' directory to have it available only temporarily.
Installing saves time on future installations but makes the perl
installation bigger.
You can choose if you want to always install (yes), never install (no)
or be always asked. In the latter case you can set the default answer
for the question to yes (ask/yes) or no (ask/no).
<build_requires_install_policy>
Policy on installing 'build_requires' modules (yes, no, ask/yes,
ask/no)? [yes]
o conf init prerequisites_policy
The CPAN module can detect when a module which you are trying to build
depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Choosing
'follow' also sets PERL_AUTOINSTALL and PERL_EXTUTILS_AUTOINSTALL for
"--defaultdeps" if not already set.
Please set your policy to one of the three values.
<prerequisites_policy>
Policy on building prerequisites (follow, ask or ignore)? [follow]
After you've set them, don't forget to do a:
o conf commit
...to save your changes.
Now run:
cpan Module::Build
...and finally, run your build script:
./Build.PL
I want to monitor an esxi server with the Nagios plugin check_esxi. I am getting this error when executing it:
Undefined subroutine &Util::disconnect called at /usr/local/nagios/libexec/check_esx3-0.5.pl line 555
I followed these installation instructions. The Perl libraries and its modules are installed:
Nagios::Plugin via CPAN
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload CPAN
cpan> install Nagios::Plugin
cpan> install Crypt::SSLeay
cpan> install Compress::Zlib
Despite that, the error (which seems to point to a missing library) still occurs.
Util::disconnect() is defined in VMware::VIRuntime, which can be found in VILib.pm, which is part of the VMware vSphere SDK for Perl API. You have to install VMware vSphere SDK for Perl API in order to run check_esx3.pl.
Installation instructions can be found here: https://kb.op5.com/display/HOWTOs/How+to+Install+VMware+vSphere+SDK+for+Perl+5.1
More information (for instance: links to the source) can be found here: https://www.vmware.com/support/developer/viperltoolkit/viperl-1-200706-releasenotes.html
The correct module name where Util::disconnect() is defined is /usr/local/share/perl5/VMware/VICommon.pm
VMware apparently discontinued its support for the VIPER (VMware Infrastructure Perl) SDK.
I ended up locating old 32-bit installation package and placed / modified files manually.
This question already has answers here:
issues installing perl DBI-mysql in windows
(3 answers)
Closed 8 years ago.
I am using perl 5.18.1.1800 with ppm 4.19 in a Windows 7 64 bit machine.
I need to use DBD-mysql to be able to access mysql from perl. But I get below error message:
use DBI();
my $dbh = DBI->connect("DBI:mysql:database=mydbname;host=localhost","myuser", "mypass",{'RaiseError' => 1})
install_driver(mysql) failed: Can't locate DBD/mysql.pm in #INC (you
may need to install the DBD::mysql module)
So i tried to install DBD-mysql, but i don't have that listed in my PPM. In command line, when I tried to install, i get below error
ppm install DBD-mysql
ppm install failed: Can't find any package that provides DBD-mysql
I tried to download and install it, but it requires a C compiler which I don't have.
From DBD-mysql info page, there is no mentioning of Perl 5.18 support for the module.
So, should I revert back to 5.16.xx or the problem is something else?
Thanks,
DBD-mysql is available for ActivePerl-5.16.3.1604. Reverting back to that version is probably simpler than installing a compiler to build the package yourself.
Activestate used Visual Studio to build DBD-mysql: http://ppm4.activestate.com/MSWin32-x86/5.16/1600/C/CA/CAPTTOFU/DBD-mysql-4.022.d/log-20120830T032945.txt
C:\>ppm install DBD-mysql
Downloading ActiveState Package Repository packlist...done
Updating ActiveState Package Repository database...done
Syncing site PPM database with .packlists...done
Downloading DBD-mysql-4.022...done
Unpacking DBD-mysql-4.022...done
Generating HTML for DBD-mysql-4.022...done
Updating files in site area...done
12 files installed
The name of the module is DBI. Try using:
ppm install DBI
*Disclaimer: I haven't used Perl on Windows, rather Perl on Linux, so I assumed the syntax for using ppm is "ppm install modulename".
also, the correct syntax hereafter would be:
my $dbh = DBI->connect(DBI:mysql:DBNAME, $username, $pass, {RaiseError => 1, AutoCommit
=> 1}) or die "Could not Connect to DB";
I tried to upgrade my custom perl version from 5.10.1 to 5.16.3, and now I am getting following errors in my logs:
[Wed May 21 00:05:32 2014] [error] Can't locate unicore/Canonical.pl
in #INC (#INC contains: /opt/test/perl/lib/5.10.1/i686-linux
/opt/test/perl/lib/5.10.1
/opt/test/perl/lib/site_perl/5.10.1/i686-linux
/opt/test/perl/lib/site_perl/5.10.1 . /opt/test/httpd) at
/opt/test/perl/lib/5.10.1/utf8_heavy.pl line 139.\n
Can anyone please help me to sort it out?
try re-installing the missing modules using cpan.
the "upgrade" probably created a second, parallel Perl installation on your system...
did you then remove the 'old' version?
Follow below commands:
1/ Install cpan with yum install cpan or apt-get install cpan
2/ On the command prompt enter: cpan install unicore:Canonical