I created some proprietary Perl modules I can't share so I put them into a local "darkpan" with orepan2. Here is the beginning of 02packages.details.txt.
[~] $ gunzip -c darkpan/modules/02packages.details.txt.gz
File: 02packages.details.txt
URL: http://www.perl.com/CPAN/modules/02packages.details.txt
Description: DarkPAN
Columns: package name, version, path
Intended-For: Automated fetch routines, namespace documentation.
Written-By: OrePAN2 0.47
Line-Count: 30
Last-Updated: Wed Apr 24 15:44:46 2019
MyProj::MyMod 1.201904241840 D/DU/DUMMY/MyProj-MyMod-v1.20190424.1840.tar.gz
When I type
cpanm --mirror=file:///path/to/darkpan --mirror-only MyProj::MyMod
it responds that MyProj::MyMod is up-to-date even though the version in darktab is newer. To get it to install, I have to say "MyProj::MyMod-201904241840" on the command line.
Why won't cpanm recognize that the version in the darkpan index is newer than the one installed?
Why can't I just say
cpanm --mirror=file:///path/to/darkpan --mirror-only MyProj-MyMod
in order to load this as a module and not a single package?
as far as I know, cpanm is right, ‘up-to-dateness’ is based on the fact that something is installed that fits the minimal version specified... which you didn’t. correct me if i’m wrong, but there is a reinstall option that would do the trick and get any latest it can find
Related
I run into this every so often: I run a brew install foobar and as a result, Perl version gets updated. Whenever this happens, the Perl modules that I had installed are no longer found because they were installed in /usr/local/Cellar/perl/5.32.0/lib/perl5/site_perl/5.32.0/ and the new version is now looking in /usr/local/Cellar/perl/5.32.0/lib/perl5/site_perl/5.32.1_1/.
I have/had a ton of modules installed with the previous version and I'd rather not reinstall all of them (at least manually). What's the best way to have the previously-installed modules work with the new Perl version?
For such a small version change above, I could presumably just copy all of the files from the 5.32.0 dir to the 5.32.1_1 dir, but preferably there is a more general and/or robust solution for when the version change is more substantial.
The cpan command can make an "autobundle" file. You'd use the cpan from the prior installation to do this:
$ cpan -a
Creating autobundle in /Users/brian/.cpan/Bundle
Reading '/Users/brian/.cpan/Metadata'
Database was generated on Fri, 19 Mar 2021 05:41:03 GMT
Package namespace installed latest in CPAN file
Algorithm::C3 0.11 0.11 HAARG/Algorithm-C3-0.11.tar.gz
Algorithm::Cron 0.10 0.10 PEVANS/Algorithm-Cron-0.10.tar.gz
Algorithm::Diff 1.1903 1.201 RJBS/Algorithm-Diff-1.201.tar.gz
...
version::regex 0.9924 0.9928 LEONT/version-0.9928.tar.gz
vmsish 1.04 1.04 SHAY/perl-5.32.1.tar.gz
warnings 1.47 1.47 SHAY/perl-5.32.1.tar.gz
warnings::register 1.04 1.04 SHAY/perl-5.32.1.tar.gz
Wrote bundle file
/Users/brian/.cpan/Bundle/Snapshot_2021_03_20_00.pm
At the top of that file, there are instructions on installing it. Use the cpan from the new installation to handle this part:
package Bundle::Snapshot_2021_03_20_00;
$VERSION = '0.01';
1;
__END__
=head1 NAME
Bundle::Snapshot_2021_03_20_00 - Snapshot of installation on otter on Sat Mar 20 00:19:35 2021
=head1 SYNOPSIS
perl -MCPAN -e 'install Bundle::Snapshot_2021_03_20_00'
I hardly ever do this though. When I install a new perl and want to use a new project on it, I install the project. That project installs whatever it needs. I like the fresh start instead of carrying over stuff I might not be using anymore.
Also, note that cpan installs the latest versions of whatever you are asking for. If you need particular versions, cpanm is easier to handle. And, in that case, you might consider using a cpanfile to lock down exactly what you want.
How to generate UUID in solaris 11?
In Solaris 10 i was using makeuuid command to generate.
I can not find it in solaris 11 while it exist as per oracle documents
https://docs.oracle.com/cd/E23824_01/html/821-1462/makeuuid-1m.html
but I can't find it, also I can not find the container package.
You can also use the very small Python program below. Would this help?
$ cat bin/uuidgen.py
#!/usr/bin/python
import uuid
print(uuid.uuid4())
$ uuidgen.py
c4f248e9-c398-4054-9208-6badd366f857
Searching for makeuuid in all Solaris 11 packages:
# pkg search -flr makeuuid
INDEX ACTION VALUE PACKAGE
basename file usr/bin/makeuuid pkg:/system/management/product-registry#0.5.11-0.151.0.1
OK, what about that package?
# pkg info -r pkg:/system/management/product-registry
Name: system/management/product-registry
Summary:
State: Not installed (Obsolete)
Publisher: solaris
Version: 0.5.11
Build Release: 5.11
Branch: 0.171
Packaging Date: August 1, 2011 04:48:45 PM
Size: 5.45 kB
FMRI: pkg://solaris/system/management/product-registry#0.5.11,5.11-0.171:20110801T164845Z
Note that the package is obsolete. You can try force-installing it, but the Solaris 11 package system might remove it on your next update.
I'm not sure why it's obsolete, but the man page you linked is part of the DCE/RPC OpenGroup specification from 1997. The version string 0.5.11-0.151.0.1 seems to indicate an old OpenSolaris/Nevada package, likely from SNV version 151.
Note that makeuuid is not in the Solaris 11.3 man pages section 1M.
If you really want that makeuuid binary, you should be able to download the package locally following this procedure: https://serverfault.com/a/348265/283415 Once you have the package on your local system, you should be able to take it apart and pull out the makeuuid binary. Note that grabbing the binary from the package won't install any dependencies, and the makeuuid binary from that old package may not work or it might work improperly on your later system.
Within my Dockerfile, I am setting up the Perl modules that will be installed when run, like so:
RUN ["cpanm", "Carp", "Carp::Heavy", "Class::Data::Inheritable"]
However, for one module, I need a specific version of a module, not the latest one. How can I specify that version in the above line?
I've been searching online for hours, and haven't turned up anything useful yet.
Instead of specifying a module name, specify a URL. Eg, instead of Class::Data::Inheritable, use https://cpan.metacpan.org/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.06.tar.gz
You can find the applicable URL by going to the module page on metacpan, selecting the version you want, and copying the download link.
PS: You might want to also set PERL_CPANM_OPT=--from https://cpan.metacpan.org/ in the environment so cpanm only downloads using HTTPS.
For anyone who's searching for this same answer in the future, another option can be found here in the documentation for cpanm:
cpanm Plack#0.9990
If you have a long list of modules, consider feeding a cpanfile into cpanm rather than listing them all in the Dockerfile.
The easiest way to specify a particular version number for a module in a cpanfile is like this:
requires 'Text::ParseWords', '==3.1';
The syntax for requesting the latest version of a module is this:
requires 'Text::ParseWords';
Requesting a minimum version: (note the lack of '==')
requires 'Text::ParseWords', '3.1';
The syntax for requesting specific versions in other ways is fairly well-documented here.
Another great write-up of the use of cpanm and a cpanfile can be found
in Installation of cpan modules by cpanm and cpanfile.
To have CPAN install a specific version of a module, you need to provide the full module distribution filename including the author. For example to install the module Set::Object version 1.28, at the command line type:
cpan SAMV/Set-Object-1.28.tar.gz
Same thing apply with Docker, just add
RUN cpan SAMV/Set-Object-1.28.tar.gz
To specify target module version you can use
cpanm MIYAGAWA/Plack-0.99_05.tar.gz # full distribution path
cpanm http://example.org/LDS/CGI.pm-3.20.tar.gz # install from URL
cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz # install from a local file
See official documentation: https://metacpan.org/dist/App-cpanminus/view/bin/cpanm
But better, to my mind, would be to use cpanfile. See --cpanfile option https://metacpan.org/dist/App-cpanminus/view/bin/cpanm#-cpanfile and format of this file https://metacpan.org/pod/cpanfile
But if you have many modules (like me), I recommend to use cpm. It installs modules in parallel very fast. Also with help of docker we could cache builds, thus rebuilds will takes seconds. Here is my Dockerfile:
## Modules
WORKDIR ${APP_ROOT}
# install modules outside of WORKDIR, so it will not interfere when we do COPY . .
RUN mkdir -p ../modules
RUN ln -s ../modules local
RUN cpanm -n -L ./local App::cpm Carton::Snapshot && rm -rf /root/.cpanm
COPY cpanfile ./
COPY cpanfile.snapshot ./
RUN \
--mount=type=cache,target=/root/.perl-cpm \
cpm install -w 16 --no-test -L ./local \
--with-develop
# regenerate cpanfile.snapshot
# https://github.com/miyagawa/Carmel#cpm
# cpm doesn't have the ability to manage cpanfile.snapshot file on its own.
RUN carton install
# You can copy snapshot from container by running:
# docker cp <container_name>:${APP_ROOT}/cpanfile.snapshot.latest ./cpanfile.snapshot
I am following the below procedure for installing LDAP in unix
1.tar -xzf perl-ldap-0.43.tar.gz
2.cd perl-ldap-0.43
3.perl MakeFile.PL
I am getting below message
* Checking for Perl dependencies...
We have to reconfigure CPAN.pm due to following uninitialized parameters:
cpan_home, keep_source_where, build_dir, build_cache, scan_cache, index_expire, gzip, tar, unzip, make, pager, makepl_arg, make_arg, make_install_arg, urllist, inhibit_startup_message, ftp_proxy, http_proxy, no_proxy, prerequisites_policy, cache_metadata
CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.
If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)
Are you ready for manual configuration? [yes]
How to install without CPAN and what are the dependent modules required to install Ldap?
Can anyone suggest me the standard process of installation.
Thanks In Advance
I assume that by perl-ldap-0.43.tar.gz you are trying to install Net::LDAP
How to install without CPAN?
CPAN is the recommended way of installing Perl modules. You have to configure it just once, after that if you need to install any Perl module you can just type the below.
$ cpan ModuleName like in your case instead of downloading, untaring and running makefile you can just do:
$ cpan Net::LDAP
What are the dependent modules required to install Ldap?
One more advantage of using CPAN is you don't have to care about dependencies. CPAN will install dependencies automatically if you ask it to do so. Do it by
$ perl -MCPAN -e shell
cpan[1]> o conf prerequisites_policy follow
cpan[2]> o conf commit
exit
Or just use App::cpanminus and run
$ cpanm Net::LDAP it will install the module with all its dependencies.
Also check out Perl LDAP page.
Edit: Based on your answer
You will get some errors like above, you will have to see the error log, check the Module which is missing, then go to CPAN and download that module's tar.gz and then do the same steps as you were doing, like untaring, and running Makefile. You will have to do this unless all of your dependencies are installed.
Can we ignore warnings while installing perl modules?
I have installed ExtUtils-MakeMaker-6.98.tar.gz by ignoring below warnings
Using included version of ExtUtils::Install (1.54) as it is newer than the installed version (1.33).
Using included version of CPAN::Meta::YAML (0.008) because it is not already installed.
Using included version of JSON::PP::Compat5006 (1.09) because it is not already installed.
Using included version of ExtUtils::Manifest (1.60) as it is newer than the installed version (1.46).
Using included version of version (0.88) because it is not already installed.
Using included version of ExtUtils::Command (1.16) as it is newer than the installed version (1.09).
Using included version of CPAN::Meta (2.120351) because it is not already installed.
Using included version of JSON::PP (2.27203) because it is not already installed.
Using included version of File::Temp (0.22) as it is newer than the installed version (0.16).
Using included version of Parse::CPAN::Meta (1.4405) because it is not already installed.
Using included version of File::Copy::Recursive (0.38) because it is not already installed.
Checking if your kit is complete...
Warning: the following files are missing in your kit:
't/liblist/win32/di
't/liblist/win32/space
Please inform the author.
Generating a Unix-style Makefile
Writing Makefile for ExtUtils::MakeMaker
Writing MYMETA.yml and MYMETA.json**
But I'm able to install successfully. Will it create any problems in future?
I'm trying to install Maatkit following the maatkit instructions. I can't get past having to install DBD::mysql. "Warning: prerequisite DBD::mysql 1 not found."
When I try to install DBD::mysql from cpan, I get very helpful "make had returned bad status, install seems impossible".
Perl is "v5.8.8 built for darwin-thread-multi-2level", the one that came with OS X. I also tried building from source with same result.
We need more of the error message. Most likely, you are missing the MySQL client development files. I don't know how to install these on OSX. Also see this older post on OSX 10.5.2 , in which some other failures with the mysql client libraries are found.
Possibly post this question with more parts of your error message at perlmonks.org, if stackoverflow doesn't allow for convenient pasting of your make session or rather the last 20 or 10 lines of it.
Some more Googling with site:perlmonks.org also finds this post which has some more details on things to watch out for when installing DBD::MySQL. Depending on how comfortable you feel with the installation, you might want to manually run the tests, supplying a test database and test user or even skip testing the module.
After a bit more googling, this worked for me:
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
sudo ln -s /usr/local/mysql/include /usr/local/mysql/include/mysql
sudo perl -MCPAN -e 'install Bundle::DBD::mysql'
press enter a bunch of times, then in your maatkit folder:
perl Makefile.PL
sudo make install
and you'll find the mk-* programs in /usr/local/bin/
You will want to install MySQL first. I usually use the binary packages they provide for OS X. The packages do include the headers and MySQL client libraries which DBD::MySQL requires. Once the MySQL package is installed, DBD::MySQL should install without issue.
Here is my output:
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite DBD::mysql 1 not found.
Writing Makefile for maatkit
$ mysql --version
mysql Ver 14.12 Distrib 5.0.51b, for apple-darwin9.0.0b5 (i686) using readline 5.0
I notice that there are in effect DBD::MySQL packages in the fink repositories. For example:
ayaz#ayazs-macbook$ fink list | grep -i 'dbd-mysql'
dbd-mysql-pm586 3.0008-10 Perl5 Database Interface to MySQL
dbd-mysql-pm588 3.0008-10 Perl5 Database Interface to MySQL
Perhaps installing through fink one of those packages may help alleviate your troubles.
Also, and I cannot be certain of this, you may want to install for MySQL-5.x (if you have that version installed) the mysql15-dev and mysql15-shlibs packages. I installed those through fink thus:
$ sudo fink --use-binary-dist install mysql15-dev