How can I install script distributions from CPAN? - perl

I tried:
cpan> i /xls2csv/
No objects found of any type for argument /xls2csv/
cpan> install xls2csv
Warning: Cannot install xls2csv, don't know what it is.
Try the command
i /xls2csv/
to find objects with matching identifiers.
I haven't had any problems installing registered modules, e.g.
cpan> install DateTime
It is just the xls2csv that is providing problems.
Thank you for any insights provided.
P.S. Constrained To Windows with ActivePerl 5.10 (I think) Also I have the xls2csv-1.06.tar.gz file downloaded and tried
cpan> install C:/...path to file locally/xls2csv-1.06.tar.gz
That did not seem to work, and I must install locally.

The indexes used by CPAN.pm are all module-oriented, so they don't see distributions that contain no modules. (xls2csv has only a script.) You can still install them by giving the full path (under authors/id) of the distribution, just as you would to install older or development versions of a distribution:
cpan> install K/KE/KEN/xls2csv-1.06.tar.gz

If you are using my cpan(1) command, you can also install whatever is in the current working directory by telling it to install ".".
% cpan .
That should trigger the normal CPAN.pm process for handling dependencies and so on. You should be able to do that in the CPAN.pm shell too.
If you want to fetch the file from a CPAN mirror, you can do it as ysth suggested. You give it the path under authors/id in the repository and CPAN.pm will find it for you. You're skipping the step where it looks in the PAUSE index because you've already given it the path to download.

It's a 5 year old script with few tests (7) none on a Mac, and one bug report (a year old). It appears to not have been updated since it was written so use this script with realistic expectations. In other words, don't be surprised if you can't get it to work.

Related

Variant Effect Predictor | DBD mysql failing to setup

I trying to get set up with Variant Effect Predictor (VEP) on the command line. I'm following the setup tutorial but I'm encountering some errors around dependencies. I'm also quite new to the command line so if anyone is able to break down the solution too then I'd be very grateful. Thanks!
Tutorial: https://www.ensembl.org/info/docs/tools/vep/script/vep_tutorial.html
VEP requirements: http://www.ensembl.org/info/docs/tools/vep/script/vep_download.html#requirements
I also have Perl v5.32.1.
What I've done:
I installed dependencies (listed in the requirements page) with the following commands:
- sudo -s cpanm DBI
- sudo -s cpanm Archive::Zip
- sudo -s cpanm DBD::mysql
For DBD:mysql, I got the follwoing message:
--> Working on DBD::mysql
Fetching http://www.cpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-4.050.tar.gz ... OK
Configuring DBD-mysql-4.050 ... N/A
! Configure failed for DBD-mysql-4.050. See /root/.cpanm/work/1626111140.5937/build.log for details.
Trying it out anyway, I ran perl INSTALL.pl (from the tutorial page) and got the message below. I would like VEP to run in online mode too if possible.
`WARNING: DBD::mysql module not found. VEP can only run in offline (--offline) mode without DBD::mysql installed
http://www.ensembl.org/info/docs/tools/vep/script/vep_download.html#requirements
Hello! This installer is configured to install v104 of the Ensembl API for use by the VEP.
It will not affect any existing installations of the Ensembl API that you may have.
It will also download and install cache files from Ensembl's FTP server.
Checking for installed versions of the Ensembl API...done
Setting up directories
Destination directory ./Bio already exists.
Do you want to overwrite it (if updating VEP this is probably OK) (y/n)? y
- fetching BioPerl
- unpacking ./Bio/tmp/release-1-6-924.zip
ERROR: Unable to unpack file ./Bio/tmp/release-1-6-924.zip without Archive::Extract or tar/unzip/gzip`
You show us this error:
Configure failed for DBD-mysql-4.050. See /root/.cpanm/work/1626111140.5937/build.log for details.
So looking in there will give you more clues about what the problems are. Without that, we can only guess.
But we can make educated guesses. The DBD::mysql distribution comes with a file called DBD::mysql::INSTALL which will talk you through some of the problems you'll find while installing this module.
It's important to note that DBD::mysql is a wrapper around MySQL's client libraries. They are written in C, so you'll need a C compiler installed in order to build DBD::mysql. You'll also need the client libraries and the development versions of the client libraries (for the C header files that you'll need to compile the module). On Ubuntu, those packages are called "libmysqlclient" and "libmysqlclient-dev". If you don't have a C compiler, then you'll want to install "gcc" too.
But this is all getting a bit complicated. There's another, simpler, approach. If you're using the system version of Perl (the version that was installed as part of the operating system and probably lives in /usr/bin/perl) then I'd recommend using the pre-build Ubuntu version of the package, which you can install by running:
$ sudo apt-get install libdbd-mysql-perl
Installing that version uses the OS's own package manager, and the package manager knows which other packages are needed in order for it to work - so it will install those as well.
People will probably complain that you're better off installing the modules from CPAN as it gives you more flexibility and allows you to use more up-to-date packages than the versions from your OS repos. And they're right. But, honestly, if you're a non-Perl programmer who just wants to get an application up and running, this is by far the simplest approach.
(But, as I said above, this is all guesswork as you haven't shared the most important errors with us.)

Why won't cpanm install dependencies?

I'm trying to install PAR from cpanm like so: cpanm App::Packer::PAR, but it's giving me this error:
skipping R/RJ/RJBS/perl-5.22.0.tar.bz2
! Installing the dependencies failed: Module ExtUtils::Embed is not installed
! Bailing out the installation for PAR-Packer-1.026.
Even though cpanm is supposed to automatically install dependencies, I tried installing it manually: cpanm ExtUtils::Embed, but only got the same error: skipping R/RJ/RJBS/perl-5.22.0.tar.bz2
Any ideas as to why this is failing and how I can make it work?
ExtUtils::Embed is a dual-lifed module, meaning it's distributed as part of the perl distribution as well as in a second distribution.
cpanm is trying to install ExtUtils::Embed by installing the perl distribution instead of the ExtUtils-Embed distribution. Why? I'm not sure. Maybe because it's newer (1.32 instead of 1.2505).
cpanm is wisely unwilling to upgrade perl itself.
Now, the latest App::Packer::PAR's META doesn't specify a minimum version of ExtUtils::Embed, so the version in the ExtUtils-Embed distribution could very well be good enough. The following command will achieve this:
cpanm D/DO/DOUGM/ExtUtils-Embed-1.14.tar.gz
HOWEVER, as I mentioned earlier, ExtUtils::Embed comes with Perl. It has done so for over 15 years (since before Perl 5.4). It makes no sense that you have to install it.
You appear to be using a system whose provider decided to cause headaches by breaking the perl distribution into multiple packages. You should use your system's package manager (apt-get, yum or whatever) to install the missing portions of perl rather than using cpanm.

CPANM, "Couldn't find module or a distribution Archive::zip"

I am trying to write something in Perl that needs several modules, however this is my first time using Perl and I cannot seem to install one specific module I need, Archive::zip.
I am using perlbrew and use the following command to attempt to install the module:
cpanm install Archive::zip
This returns to me the following messages through the command line:
install is up to date. (0.01)
! Finding Archive::zip on cpanmetadb failed.
! Finding Archive::zip () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution Archive::zip
At first I thought that the "install is up to date meant" I had it, but anything I attempt to run requiring that module tells me that it is missing. I assume the messages after mean that it cannot find any place to install this module from, and I don't seem to have come across this issue posted anywhere online. If that is the case is there a different mirror I can specify?
In case it may be relevant to this, I am currently using OSX 10.10.2.
Module names are case sensitive: you want Archive::Zip, with a capital 'Z'.
Also, when installing a module using cpanm, you can save a few keystrokes by omitting install, it's the default behaviour. Quoting from the documentation:
(arguments)
[...]
-i, --install
Installs the modules. This is a default behavior and this is just a compatibility option to make it work like cpan or cpanp.
This means you can install Archive::Zip using
cpanm Archive::Zip
As the previous poster noted, module names are case-sensitive, so "cpanm Archive::zip" won't find "Archive::Zip."
As for "install is up to date", this is a bit confusing at first. The cpanm program takes options, which begin with a dash, and arguments, which don't. If you don't specify any options, the default behavior is to install the modules you specify as arguments. So the proper command is just "cpanm Archive::Zip". If you want to tell cpanm to do something else, you would say it with an option: for example, "cpanm --showdeps Some::Module" would show the dependencies of Some::Module but not install anything.
If you say "cpanm install Archive::Zip", what you're telling it to do is first install the module called "install" and secondly install "Archive::Zip." And there is a module called "install" -- it doesn't do anything, but was created specifically to avoid "Couldn't find module or distribution" errors when people absentmindedly typed "cpan install Some::Module". So "install is up to date (0.01)" means that you have previously installed the "install" module, and the version you have is the latest version. (Which is not surprising as a module that doesn't do anything is not likely to need revision.)

How to get p5-Switch on ubuntu 12.10

I was using ubuntu 12.04 until 12.10 was released. I used ubuntu for software development and after installing 12.10, i noticed that the perl version (5.14) shipped with 12.10 does not include the Switch.pm module needed while building WebKiT-GTK.
Looking around on the internet i found few suggestions indicating that i should install something call p5-switch from something called ports. I have looked around and was not able to get this done. I am not a perl guy and have no idea where i can get this package.
Can someone please help me as to
1. Where to download the package for ubuntu 12.10
2. In case it is not a .deb, How do i install it.
OR
1. At least be able to downgrade the perl installation to something lower than 5.14
Thanks and Regards
~Sameer
sudo apt-get install libswitch-perl
will install it for you.
"ports" is a *BSD packaging system of sorts, not what you should be looking for.
You can find what package has a particular perl module by going to packages.ubuntu.com, entering Module/Name.pm (in this case, Switch.pm) in the "Search the contents of packages" form and checking "packages that contain files whose names end with the keyword" and selecting the desired distribution, then making sure you ignore false hits like CGI/Switch.pm in the results. Debian has the identical search for its packages at packages.debian.org.
(Note that Switch.pm has serious limitations, was never really intended to be used in production, and should certainly not be used in new code.)
Do make sure you've checked properly that there isn't the Switch module available via apt. If it is available, that's the one you want.
No, then you've two options the longer, correct way and a shorter way that's not quite as clean.
1. Longer
Install cpanm and perlbrew with apt. The perlbrew tool lets you install a complete version of Perl from scratch in a separate directory. Set up a user for your webkit building, run perlbrew as that user, install your perl. Then, use cpanm to install required modules and you are done. A bit of googling will get you step-by-step examples of how to use these tools. If anything goes badly wrong, you can just delete all the files in that user's home directory and start again - all you waste is a little time.
The reason experienced Perl people prefer this is that it keeps the perl you want for webkit-gtk separate from your system perl that ubuntu's packages will expect to be unchanged from the one they ship.
2. Shorter
Install cpanm with apt. As root, run "cpanm Switch" and it will install the Switch.pm package and any dependencies. It will also upgrade any already installed packages it thinks it needs to. This last step is why this option isn't ideal. In the (rare) case when the update isn't compatible with something else on your system uninstalling is fiddly.

error running cpan the first time

I'm wondering if anyone can help me. I installed CPAN.pm via command line and then tried installing a module via CPAN. But I encountered an error:
Can't call method "http" on unblessed reference at /usr/lib/perl5/5.10.0/CPAN/FirstTime.pm line 1866.
This error can be resolved by entering the username and password fields in the proxy that cpan uses.
1] First Install cpan by
sudo yum install perl-CPAN
2] Then run the following command
cpan
It asks for setting basics, then select "NO" option for automatically picking then keep pressing enter till you are asked for "Automatically connect to internet", press no.
3] Then you will be asked for mirror details keep selecting from the list that it provided.
4] Then set the proxy username and password fields
5] Installation will then be complete and it will take you to cpan> prompt like below
cpan>
6] In the prompt enter
install Bundle::LWP
Firstly I'm surprised that CPAN isn't already installed as it has been part of the standard Perl distribution since Perl 5.004 was released fifteen years ago.
Secondly I'm surprised that you're still using Fedora 11. That version has been unsupported since June 2010.
Thirdly, I'm surprised that you want to use CPAN.pm as CPANPLUS and cpanminus are both far better interfaces to CPAN.
But given all of those surprises, if you want CPAN on your system, the best approach is probably to use the one that the Fedora project have pre-built for you.
$ sudo yum install perl-CPAN
There will be a number of CPAN modules available pre-build from Fedora. You can see them all using:
$ yum list available perl-\*
You'll find even more available for recent versions of Fedora.
You can almost certainly get CPANPLUS by installing perl-CPANPLUS. I doubt whether cpanminus is available for such an old version of Fedora.
I just had the same issue while installing Perlbrew.
After doing some debugging, I found out that this error happens because the CPAN logic could not find a mirror candidate. Of course, this could be improved in the CPAN::Mirrors or CPAN::FirstTime by just checking the results returned by the related functions.
Since those are not checked (and thus assumed that always returns some value) I got this meaningless error. But I must say I didn't checked further to see why no value is being returned after all.
You can safely avoid this error by simply selection No as answer for the automatic configuration. Of course, you will need to reply for each one of the configuration directives.
I got this while installing perl 5.16.3 thru perlbrew.
I had the same error, and did not have root privileges. The problem lay with there being two versions of cpan installed:
/usr/bin/cpan
/usr/local/bin/cpan
When I specified the former, things began to work.
replace Config.pm with fixed vertion
wget http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/CPAN-2.16.tar.gz
tar -zxvf CPAN-2.16.tar.gz
sudo mkdir /usr/share/perl5/CPAN/ -p
sudo cp ./CPAN-2.16/lib/CPAN/FirstTime.pm /usr/share/perl5/CPAN/FirstTime.pm
source