I'm trying to do a temporary install of some cpan modules into a custom folder (/tmp/perl). So I have amending the build install base with...
o conf mbuildpl_arg "--install_base /tmp/perl"
o conf makepl_arg "INSTALL_BASE=/tmp/perl"
Which works fine, the modules get installed into that directory now. I also set PERL5LIB with
PERL5LIB=/tmp/perl/lib/5.14.2/:/tmp/perl/lib/site_perl/:/opt/perl/lib/5.14.2/:/opt/perl/lib/site_perl/:
Note, this is all just temporary, on a virtual server which will be destroyed.
I note that, previously it would install modules into buildpath/lib/5.14.2 or buildpath/lib/site_perl
However now, its installing modules into buildpath/lib/perl5
My understanding was that core perl modules ended up in buildpath/lib/5.14.2 and non-core modules ended up in buildpath/lib/site_perl.
As this is installing into buildpath/lib/perl5, what decides to install into the perl5 directory as opposed to 5.14.2 or site_perl ?
Unless you override ExtUtils::MakeMaker and Module::Build through environment variables (i.e. values in PERL_MM_OPT and PERL_MB_OPT) or command line arguments (e.g. values in cpan's mbuildpl_arg and makepl_arg), locations hardcoded into Perl when it was built will be used. The following command will show you those locations (for .pm and associated files):
perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib contains the "pure Perl" modules that came with Perl.
installarchlib is the same for modules with arch- or build-dependent components.
installvendorlib contains the "pure Perl" modules installed by your distro.
installvendorarch is the same for modules with arch- or build-dependent components.
installsitelib contains the "pure Perl" modules installed by you.
installsitearch is the same for modules with arch- or build-dependent components.
Example runs:
$ perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib='/usr/share/perl/5.14';
installarchlib='/usr/lib/perl/5.14';
installvendorlib='/usr/share/perl5';
installvendorarch='/usr/lib/perl5';
installsitelib='/usr/local/share/perl/5.14.2';
installsitearch='/usr/local/lib/perl/5.14.2';
$ perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/5.20.1';
installarchlib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/5.20.1/x86_64-linux-thread-multi';
installvendorlib='';
installvendorarch='';
installsitelib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/site_perl/5.20.1';
installsitearch='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/site_perl/5.20.1/x86_64-linux-thread-multi';
>perl -V:"install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)"
installprivlib='C:\progs\sp5280-x64\perl\lib';
installarchlib='C:\progs\sp5280-x64\perl\lib';
installvendorlib='C:\progs\sp5280-x64\perl\vendor\lib';
installvendorarch='C:\progs\sp5280-x64\perl\vendor\lib';
installsitelib='C:\progs\sp5280-x64\perl\site\lib';
installsitearch='C:\progs\sp5280-x64\perl\site\lib';
There is no answer posted here. I have the same problem. cpan and cpanm installs are going into (using X to shorten paths):
/X/lib/perl5
but that path is not in #INC:
perl -V
#INC:
/X/lib/perl5/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/5.22.0
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/site_perl
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/5.22.0
PERL_MM_OPT and PERL_MB_OPT have the following values, which do not appear to be incorrect:
PERL_MB_OPT="--install_base /X"
PERL_MM_OPT="INSTALL_BASE=/X"
I have Perl installed within a conda environment. I suspect the problem is that CPAN and CPANM are making improper assumptions about the subdirectory structure underneath the paths contained in PERL_MB_OPT and PERL_MM_OPT.
Related
I have a script on Windows which uses multiple pure Perl modules from CPAN.
I am trying to ship this script without the need to reinstall those modules from CPAN using App::FatPacker.
I installed App::FatPacker ( up to date (0.010007) version ) on Portable Strawberry Perl 5.24 .
When I run the following command
fatpack pack myscript.pl > myscript.packed.pl
I get
syntax OK
but the fatlib is empty and when I run my script it fails.
I tried to use this script which does nothing but load Geo::IP::PurePerl
use strict;
use warnings;
use Geo::IP::PurePerl;
and run again this command :
fatpack pack myscript.pl > myscript.packed.pl
Then I ran myscript.packed.pl on another instance of Strawberry Perl 5.24, I get the following error:
Can't locate Geo/IP/PurePerl.pm in #INC (you may need to install the Geo::IP::PurePerl module
I tried to debug it by building step by step
The fatpack trace creates a trace list as expected, including Geo::IP::PurePerl
The fatpack packlists-for finished successfully but the fatlib is empty.
Any idea?
I would say that packlists-for isn't finding any .packlist files
The documentation for fatpack says this
packlists-for
$ fatpack packlists-for Module1 Module2 Module3
Searches your perl's #INC for .packlist files containing the .pm files for the modules requested and emits a list of unique packlist files to STDOUT.
These packlists will, in a pure cpan-installation environment, be all non-core distributions required for those modules.
Unfortunately most vendors strip the .packlist files so if you installed modules via e.g. apt-get you may be missing those modules; installing your dependencies into a local::lib first is the preferred workaround.
I think that's useful advice that may well fix your problem
Let's assume there is a distribution "Example" that is packed in example-1.0.tar.gz which contains a Makefile.PL that points to all dependencies. After extracting, "Example" could be easily installed (including all its dependencies) by calling cpanm . if all its dependencies were available on CPAN.
How do I install a simialar file (let's call it example-2.0.tar.gz) if I am given a folder "deps" containing most of the distribution's dependencies
dependency-1.tar.gz
dependency-2.tar.gz
...
dependency-N.tar.gz
where N is a huge number?
Further assumptions are:
dependency-*tar.gz files have to be preferred over the available CPAN modules
some dependencies are not available on CPAN but only in this "deps" folder
the folder "deps" is incomplete and further dependencies have to be installed from CPAN.
Is there a simple way to install example-2.0.tar.gz?
I would like to know if there is some command line like cpanm --use-local-deps=~/deps example-2.0.tar.gz which does not need further workarounds.
You could use this tool http://search.cpan.org/~bingos/CPANPLUS-0.9152/bin/cpan2dist . It lets you specify filters to define what modules are loaded locally and what is fetched from CPAN. It's part of the CPANPLUS module, which should cone with newer versions of Perl I think.
How can I set where Perl looks for modules in Apache httpd.conf file on OSX?
I've installed several modules via CPAN, which were installed successfully in
/opt/local/lib/perl5/site_perl/5.8.9
I can verify this via perldoc perllocal
If I run perl -V on the command line, I get (among other dirs):
#INC:
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level
/opt/local/lib/perl5/site_perl/5.8.9
When I run a perl script as CGI via Apache, however, I get errors that the modules I'm useing can not be found. The list of dirs being included in #INC do not match my local perl configuration.
[error] [client 127.0.0.1] Can't locate Spreadsheet/ParseExcel.pm in #INC (
#INC contains:
/Library/Perl/Updates/5.8.8
/System/Library/Perl/5.8.8/darwin-thread-multi-2level
/System/Library/Perl/5.8.8
/Library/Perl/5.8.8/darwin-thread-multi-2level
/Library/Perl/5.8.8
/Library/Perl
/Network/Library/Perl/5.8.8/darwin-thread-multi-2level
...
How is #INC getting set when running perl as CGI on OSX - and how do I override it?
The initial value of #INC is hardcoded when perl is built, but it can be modified in a number of ways. The most convenient here are
SetEnv PERL5LIB ...
from within the Apache configuration, or using
use lib qw( ... );
from within the Perl script.
That said, it's not safe to use modules installed using Perl 5.8.9 with Perl 5.8.8 (although the other way around is safe). Even worse, one appears to be a threaded Perl and the other one isn't. Modifying #INC is simply not going to work.
You need to install the module using the same perl as the one you intend to use to run the script, or you must run the script using the same perl as the one used to install the module.
I'm working on installing a perl module (not using CPAN) on a Linux machine. When I run the command:
perl Build.PL
I get the following error:
ERROR: Missing required field 'dist_abstract' for metafile
Could not get valid metadata. Error is: Invalid metadata structure.
Errors: Missing mandatory field, 'abstract' (abstract) [Validation: 1.4],
value is an undefined string (abstract) [Validation: 1.4]
at /usr/local/share/perl5/Module/Build/Base.pm line 4559
Could not create MYMETA files
I've tried Googling bits and pieces of this error but haven't found any solutions. Just looking for a clue as to what might be causing this error.
Here's a link to a zip file containing the files required to install it:
https://oncourse.iu.edu/access/content/user/brilewis/Filemanager_Public_Files/DataDownloader.zip
First at all please make sure you have package Module::Build installed.
You need ungzip few gzipped files in this package. I don't realize why author gzipped them:
gzip -d *.gz
I really don't know why author archived each install file. It looks like some mistake to me.
Than you can install all dependencies (this module requires some):
./Build installdeps
And then finally install module itself:
./Build
./Build test
./Build install
However I must warn you that this module packaged in a bit strange way and there's no guarantee it works.
The NAME section of the module does not have a - in it, e.g.,
=head1 NAME
Foo::Bar implements a Foo framework.
will fail, but if you make it
=head1 NAME
Foo::Bar - implements a Foo framework.
then it will work.
Do you have root access on your machine? Can you use the cpan utility to build and install your module. Using cpan is fairly straight forward:
$ cpan
After that, it will do a lot of configuration, simply take the default values. When it finishes, it'll come to a cpan> prompt. All you have to do there is type this:
cpan> install Module::Name
Where Module::Name is the module you're trying to install. Check the CPAN archive to get the name of your module.
If there are any dependencies, CPAN will ask if you want to download and install those. Say Yes, and CPAN will install the dependencies, then your module.
Using cpan is the best way to install third party modules you find in the CPAN archive. It takes care of all the dependencies, testing, and building for you.
Try installing through CPAN, and then see if you still have your issues.
I need to install two Perl modules on a web host. Let's call them A::B and X::Y. X::Y depends on A::B (needs A::B to run). Both of them use Module::Install. I have successfully installed A::B into a non-system location using
perl Makefile.PL PREFIX=/non/system/location
make; make test; make install
Now I want to install X::Y, so I try the same thing
perl Makefile.PL PREFIX=/non/system/location
The output is
$ perl Makefile.PL PREFIX=/non/system/location/
Cannot determine perl version info from lib/X/Y.pm
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- Test::More ...loaded. (0.94)
- ExtUtils::MakeMaker ...loaded. (6.54 >= 6.11)
- File::ShareDir ...loaded. (1.00)
- A::B ...missing.
==> Auto-install the 1 mandatory module(s) from CPAN? [y]
It can't seem to find A::B in the system, although it is installed, and when it tries to auto-install the module from CPAN, it tries to write it into the system directory (ignoring PREFIX). I have tried using variables like PERL_LIB and LIB on the command line, after PREFIX=..., but nothing I have done seems to work.
I can do make and make install successfully, but I can't do make test because of this problem. Any suggestions?
I found some advice at http://servers.digitaldaze.com/extensions/perl/modules.html to use an environment variable PERL5LIB, but this also doesn't seem to work:
export PERL5LIB=/non/system/location/lib/perl5/
didn't solve the problem.
The answer is local::lib, but you probably already know that :)
OK, the following prescription did it:
perl Makefile.PL --skipdeps --no-manpages PREFIX=/non/system/location INSTALLSITELIB=/non/system/location/lib INSTALLSITEBIN=/non/system/location/bin INSTALLMAN1DIR=/non/system/location/man/man1 INSTALLMAN3DIR=/non/system/location/man/man3
This is just "monkey see monkey do" but now make test works.
The --skipdeps option here suppresses a convenient feature/exasperating problem with Module::Install where it tries to use CPAN.pm to download missing modules.
The --no-manpages is supposed to stop it installing man pages but it doesn't work.
Because this is the top link i thought i'd update with my experience (which has taken a while to get working, hence updating the 7 year old post).
first run perl -le 'print join $/, #INC'
add (note, no / at the end!!)
export PERL5LIB=/nonstddir/scripts/modules/lib/site_perl:/nonstddir/scripts/modules/lib
run perl -le 'print join $/, #INC' make sure the new dirs are added. this makes it work. if you add a / at the end of the path, the INC entry will look weird and wrong. Mine had a // in the middle.
When done and working, mine looks like
/nonstddir/scripts/modules/lib/site_perl/5.8.4/sun4-solaris-64int
/nonstddir/scripts/modules/lib/site_perl/5.8.4
/nonstddir/scripts/modules/lib/site_perl
/nonstddir/scripts/modules/lib/sun4-solaris-64int
/nonstddir/scripts/modules/lib
/usr/perl5/5.8.4/lib/sun4-solaris-64int
/usr/perl5/5.8.4/lib
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int
/usr/perl5/site_perl/5.8.4
/usr/perl5/site_perl
/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int
/usr/perl5/vendor_perl/5.8.4
/usr/perl5/vendor_perl