trouble installing perl module with cpanm - perl

I'm trying to install Vcf.pm from CPAN and am having no luck. Part of the problem is that I can't get cpanm to work.
This is where I started:
https://metacpan.org/pod/release/AJPAGE/Bio-Pipeline-Comparison-1.123050/lib/Vcf.pm
The Install Instructions (at the lower left if that page) gives 2 options:
cpanm Vcf
and
perl -MCPAN -e shell
install Vcf
For the second option, the first line goes okay but the second line returns:
Warning: Cannot install Vcf, don't know what it is.
Trying the first option, I get:
-bash: cpanm: command not found
That is strange, because I already installed cpanminus and it seemed to go okay, and when I give this command:
cpan App:cpanminus
I get this:
App::cpanminus is up to date (1.7044).
Can anyone help me get one of the above 2 options working so I can get the module installed? I'm just a humble dilettante where computer programming is concerned, but my understanding is that cpan is supposed to make installing modules easy, so I can't believe I've managed to fail at this!

It appears that the Bio::Pipeline::Comparison distribution is not indexed by PAUSE, so CPAN does not know how to install it. It's listed on MetaCPAN, but it was released seven years ago. The GitHub repository is missing and it's not in the author's CPAN directory. The module has disappeared. You might write to the author to ask where's it's gone if you are supporting legacy code. If you are doing new work, find something else to do the job.
As for the missing cpanm, it's probably installed but not in your PATH. You can force install it to and see where it ends up:
% cpan -f App::cpan minus

Related

Perl Can't locate XML/Simple.pm

I am working on Perl, and when I run my script I got the error said :
Can't locate XML/Simple.pm in #INC
You're already getting help in comments for getting CPAN installs working correctly, but most common Perl modules can also be installed from the Ubuntu repositories. In this case, you should also be able to sudo apt-get install libxml-simple-perl to install it from Ubuntu. If that's not the correct package name (I use Debian rather than Ubuntu, so it's possible Ubuntu may have renamed it), you can use apt-cache search XML::Simple to get a list of matching packages, then check their details with apt-cache show [package name] to determine which is the one you want.
Note, however, that the XML::Simple documentation advises "You really don't want to use this module in new code." If you are writing new code, you should probably look into another XML module. I personally use XML::Twig, which happens to offer a simplify method which produces output very much like that from XML::Simple, although you're probably better off getting used to the more robust node-based interface.

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

How do I stop cpan from reconfiguring each time? + More

I'm running on a Mac (version 10.6.3) and am struggling to understand what is going on with my Perl installation.
I let the system do a copy from my previous mac, and I appear to have a second perl installed, which appears earlier in my path. I can't tell (or remember) if I might have installed it with fink, macports or CPAN or what.
type -a cpan
cpan is /opt/local/bin/cpan
cpan is /usr/bin/cpan
I'm seeing two oddities. (To start with!) When I run cpan, and let it configure in ~lcuff/.cpan, each time I run it, it wants to reconfigure, giving the message:
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters...
Also, when I try to install File::Find::Rule (so I can list my CPAN modules, per the FAQ) I end up with an error message that I can't decipher or Google a solution for:
Use of inherited AUTOLOAD for non-method Digest::SHA::shaopen() is deprecated at /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Digest/SHA.pm line 55.
Catching error: "Can't locate auto/Digest/SHA/shaopen.al in \#INC (\#INC contains: /sw/lib/perl5 /sw/lib/perl5/darwin /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 /Users/lcuff) at /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Digest/SHA.pm line 55\cJ" at /opt/local/lib/perl5/5.8.9/CPAN.pm line 359
CPAN::shell() called at /opt/local/bin/cpan line 198
I just went through my first migration to a new Mac last week, including a switch from fink and system perl to MacPorts and custom perl, so I remember the pain all too well...
As Schwern said, /opt/local is the default install location for MacPorts; fink uses /sw.
I did encounter a similar problem with CPAN configuration, although I didn't make any attempt to determine whether it was repeatable or not.
The first time I ran CPAN config, it said that I had an existing CPAN dir at ~/.cpan and stored the configuration there.
The second time, it wanted to configure into an existing CPAN dir at ~/Library/Application Support/.cpan. I didn't feel like repeating the CPAN configuration, so I broke out, did a quick cd ~/Library/Application Support/.cpan ; rm -rf .cpan ; ln -s ~/.cpan ., and it's worked great for me since then.
Hopefully this will at least help get you pointed in the right direction.
Have a look at Perlbrew.
Perlbrew allows you to install and manage mulitple versions for Perl under your home directory at ~/perl5
Installation is easy:
curl -LO http://xrl.us/perlbrew
chmod +x perlbrew
./perlbrew install
and simply follow the instructions.
Been using it for past few months on Mac OSX and it worked like a charm!
/I3az/

How can I install script distributions from CPAN?

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.