Perl modules: step by step installation process - perl

I have a Macbook(pro 2012 model) with the latest OSX version (Yosemite). I realize perl is pre-installed on unix based systems. Now I'd like to install certain perl modules
namely
XML::simple
XML::Parser
ExtUtils::MakeMaker
I have downloaded them from here but I'm quite unsure if its for a Mac based file or not. So I'd request anyone if you can help me verify if its the right version for the Macbook and also with the step by step process to install them.
Any help is highly appreciated.
Thanks!
PS: As I have a very low data connectivity in the residential area, I will not be able to go online and install, hence I have downloaded it from the office system (Linux based).

The module distributions on CPAN aren't specific to an individual platform. Some are Perl-only, in which case it doesn't matter what the platform is, and others use XS (C) sgements, which will be configured for you when you build the module
The installation process for a Perl module is described in perlmodinstall
Briefly, it goes like this
Decompress and unpack the module — tar -xzf Module.tar.gz
Prepare the makefile — perl Makefile.pl
Build the module* — make
Test the module — make test
Install the module — make install
But there may be some variations on this. Always check the README file in the unpacked module if there is one

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.)

Installing an perl based web-app in extremely restricted environment

Because i have a long series of comments with #ikegami, I cleaning up the question, in a hope it will be more understandable. Unfortunately, english isn't my "main" language. :(
Let say, having an environment where:
no development tools are installed (no make, nor gcc or like)
perl is installed with its core packages, nothing more
no outgoing network access is allowed - e.g. the user couldn't use curl nor cpan to download/install perl dependencies
the user even doesn't have admin (root) rights
but want install and evaluate some perl based web-app, let call it as MyApp
The MyApp
doesn't uses any XS-based module. (at least, I hope - in the development me using plenv and cpanm, so never checked the installed dependencies in depth)
it is an pure PSGI app, the simple plackup app.psgi works OK
the app uses some data-files which should be included in the "deployment".
The main question is: how to prepare the MyApp, and the all used CPAN-modules, to be easily installed in such restricted environment?
The goal is:
i don't need save my efforts and my time
but i want save the user's time and want minimize the needed actions on his side, so the installation (deployment) should be simple-as-possible.
E.g. how to get an running web-app to the user's machine with minimum possible (his) steps.
- the simplest thing is could be something as:
- copy one file (zip, or tarbal)
- unpack it
- from the terminal execute some run.pl in the unpacked directory.
To get the above simple installation, my idea was the following:
1.) Create an tarball, and after the unpacking will contain 3 folders and 1 perl-script, let say:
myapp_repo/
myapp_repo/distlib #will contain all MyApp's perl modules also ALL used CPAN modules and their dependecies
myapp_repo/datafiles #will contain app-specific data files and such
myapp_repo/install.pl
myall_repo/lib #will contain modules directly used by the `install.pl`
2.) I will develop an install.pl script, and it will be used as the installer-tool, like
perl install.pl new /path/to/app_root
and it will (should):
create the all needed directories under the /path/to/app_root (especially the lib where the will install the perl modules)
will call "local" cpanm internally (from the myapp_repo/lib) to install the app's perl modules and their CPAN dependencies using only distribution files from the distlib.
will generate and install the needed runtime script and the app.psgi into the /path/to/app_root/bin
will install the needed data-files for the app.
3.) So, after this the user should be able to simply run:
/path/to/app_root/bin/plackup /path/to/app_root/bin/app.psgi
In short, the user should use:
the system-wide perl and the system-wide perl-core modules
and any other
runtime perl-scripts (like plackup)
and the required CPAN-modules
should be installed to an self-contained directory tree using only files (no net-access).
E.g. the install.pl should somewhat call internally the cpanm to achieve (as equivalent) for the following cpanm command
cpanm --mirror file://path/to/myapp_repo/distlib --mirror-only My::App
which, should install My::App and all dependencies without network access using only the files from the myapp_repo/distlib
Some questions:
Is possible to use cpanm (called as an locally installed module) without the make?
For creating the myapp_repo/distlib, me thinking about using Pinto. Is it the right tool for achieve the above?
forgot me something? or with other words:
Is the above an viable (read: working) way?
are are any other tools, which i could/should to use for simplifying the creation of such distribution tarball?
#ikegami suggesting some method:
- "install everything" in one fresh-directory on my machine
- transfer this self-contained directory to the target machine
It sound very good, because this directory could contain all the needed app-specific data-files too, unfortunately, I don't understand the details how his solution should be done.
The FatPacked solution looks interesting too - need learn about it.
Don't write your own make or installer. Just copy it make from a different machine (which is basically what apt/yum/etc do anyway, and which you'd have to do even if you wrote your own). You'd be able to use cpan in 5 minutes!
Also, that should allow you to install gcc if you need it (e.g. to install an XS module), although it doesn't sound like you do. If you do install gcc, I'd install my own perl to avoid having to deal with PERL5LIB.
Tools such as minicpan will allow you to install any module from CPAN without internet access. Of course, you can keep using the command you are already using it if mirrors the packages you need.
The above explains how to simply and quickly setup a machine so it can use cpan and thus install any module easily.
If you just want to install a specific module and its dependencies, you can completely avoid using cpan on the target machine. First, you need a fresh install of Perl (preferable of the same version as the one on the target system). Then, simply install the module to a fresh dir on your machine, and transfer that dir to the target machine. That's it; nothing else needs to be done. This even works for XS modules if the two machine are similar enough.
This is what ppm (ActiveState's Perl package manager) does.
Unfortunately, while this solution is almost as simple as the one above, it's not nearly as flexible, it doesn't run the test suite of the modules being installed, etc. It does have the advantage of not requiring the transfer of any binary (if you're not installing any XS modules).

Deploying C-dependent Perl libraries

I have an application that I deploy on both Linux (Red Hat) and Unix (Solaris). My application installs itself using the built in Perl, and from then creates its own local Perl (new user).
I would like to know what is the best way to deploy Curses::UI? Currently I install other modules by just copying them to my local perl lib folder, but these are pure Perl modules that don't depend on C libraries (.so shared objects, XS, etc.).
Also will I have to compile libncurses for each platform beforehand?
NOTE: The computer doesnt have network connectivity, hence I cant use the CPAN module.
You should use a CPAN client (CPAN.pm, CPANPLUS) to deploy modules such as Curses::UI from CPAN. Usually you need development libs to compile XS modules. For Curses::UI the Ubuntu package is called libncurses-dev. Other Linux distributions probably have an ncurses devel package under the same or similar name.
You said you have a local Perl lib. A very good way to have a local lib is the module of the same name - local::lib. Its documentation will tell you how to easily install modules into your local::lib using a CPAN client.
For the CPAN modules that need to be built, try looking at carton. It has a bundle command that will bundle all your cpan modules together so they can be installed/built on the target machines without any network involved.
As for libcurses, I'd probably lean toward having a custom installer to build it on the target machine if it's not already installed. That or make your software refuse to be installed unless that library is found. Unfortunately I don't know of a good way to build dependent C libraries locally other than doing a custom build script.

Installing Perl module without CPAN

I'm writing a Perl script that does date operations that need to take holidays into account, so I think I need either Date::Manip or Date::Calc. The server I'm going to put this script on is behind a firewall and therefore CPAN can't connect to the internet. Generally I can install Perl modules by just putting the .pm files in the Perl lib folder, but these two modules both have a C++ component or depend on a non-core module (YALM::Syck for Date::Manip) with a C++ component.
The server I'm deploying to also doesn't have GCC, so copying the installation package and building it there didn't work since it couldn't compile the C++. I tried building the packages on my home Linux PC and then copying them to the server, but got an error saying the module file was incorrect. The server is an IBM AIX box, so the module I compiled for my home pc is probably incompatible.
Is there any way I can get Date::Manip or Date::Calc working on this server? Are there any pure Perl (including dependencies) modules I could use instead?
All the favourites are not pure-perl.
http://deps.cpantesters.org/?pureperl=on;module=DateTime
http://deps.cpantesters.org/?pureperl=on;module=Date%3A%3AManip
http://deps.cpantesters.org/?pureperl=on;module=Date%3A%3ACalc
Set up a development box and mirror the production server. Install the compiler in the development environment. Build the modules and package them for deployment on production (AIX has packages, right‽).
You seriously need a proper toolchain for your server, including a compiler. It's fine to build the CPAN module on another machine and copy the installed files across, but obviously the build environment has to have the same architecture, same OS, and same perl version as the operational server.

Why does CPAN.pm fail to upgrade?

Clarification: I'm pretty much a
Perl/CPAN noob, don't assume I know
too much.
I have a pretty vanilla CPAN because I just rebuild my entire Lenny 5.0.2 VPS - so I pretty much have the default modules installed.
My eventual goal is to setup foswiki on my Apache 2.x based server.
So far I'm reading this guide and it says the first thing you should do is upgrade CPAN to the latest version. So I did (as su):
# perl -MCPAN -e '$ENV{FTP_PASSIVE} = 1; install CPAN'
Now, it's installing/updating a bunch of stuff, here's an excerpt:
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-Expect-1.00.tar.gz
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-UnsatPrereq-1.00.tar.gz
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CHECKSUMS
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/cpantestdummies/
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/cpantestdummies/CPAN-Test-Dummy-Perl5-Make-Features-1.05.tgz
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/cpantestdummies/CHECKSUMS
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-Zip-1.03.zip
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CHECKSUMS.2nd
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-1.05.tar.gz
CPAN-1.9402/t/CPAN/authors/id/A/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-Failearly-1.02.tar.gz
CPAN-1.9402/t/CPAN/authors/id/A/AN/CHECKSUMS
CPAN-1.9402/t/CPAN/authors/id/A/CHECKSUMS
CPAN-1.9402/t/CPAN/authors/id/CHECKSUMS
CPAN-1.9402/t/CPAN/authors/01mailrc.txt
CPAN-1.9402/t/CPAN/CpanTestDummies-1.55.pm
CPAN-1.9402/t/CPAN/TestConfig.pm
CPAN-1.9402/t/51pod.t
CPAN-1.9402/t/02nox.t
CPAN-1.9402/t/50pod.t
CPAN-1.9402/t/10version.t
CPAN-1.9402/t/yaml_code.yml
CPAN-1.9402/t/04clean_load.t
CPAN-1.9402/README
CPAN: File::Temp loaded ok (v0.18)
CPAN.pm: Going to build A/AN/ANDK/CPAN-1.9402.tar.gz
Importing PAUSE public key into your GnuPG keychain... gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
done!
(You may wish to trust it locally with 'gpg --lsign-key 450F89EC')
Checking if your kit is complete...
Looks good
Writing Makefile for CPAN
Could not read '/root/.cpan/build/CPAN-1.9402-fmK7xK/META.yml'. Falling back to other methods to determine prerequisites
ANDK/CPAN-1.9402.tar.gz
make -- NOT OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
kat:~#
I've searched Google and came across one page that said you should whenever possible install the package from aptitude/apt-get/yum, so I found a package named libyaml-perl, marked it for download, that went through fine.
Then I re-tried my initial command that installs the latest version of CPAN and ...
CPAN-1.9402/t/50pod.t
CPAN-1.9402/t/10version.t
CPAN-1.9402/t/yaml_code.yml
CPAN-1.9402/t/04clean_load.t
CPAN-1.9402/README
CPAN: File::Temp loaded ok (v0.18)
CPAN: YAML loaded ok (v0.66)
CPAN.pm: Going to build A/AN/ANDK/CPAN-1.9402.tar.gz
Importing PAUSE public key into your GnuPG keychain... done!
(You may wish to trust it locally with 'gpg --lsign-key 450F89EC')
Checking if your kit is complete...
Looks good
Writing Makefile for CPAN
ANDK/CPAN-1.9402.tar.gz
make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
No clue what I should do now. Is there a way I can reset everything? Maybe I need to kill the file it tried to process so it can try to re-process it or something along those lines? If anyone else has general CPAN tips in addition to figuring out what this is, I'd be grateful.
Did I install the yaml package the right way?
Should I have done it from within CPAN?
What proper steps or modules should I get first?
Eventually I'll need to install these for foswiki:
CGI::Session - Needed for Foswiki's session feature which is really a must have
Error - Needed if you later want to develop plugins. It is also distributed with Foswiki but the author has experienced lots of trouble with the build script that builds plugins which sometimes cannot find this library. By adding it to the site Perl library you avoid this kind of trouble.
FreezeThaw - an indirectly needed module used by other modules.
GD - Used by the pluging that can produce graphics such as Foswiki:Plugins.ChartPlugin. It requires that lib gd is installed. If your choice of installation does not include you simply need to install the rpms gd and gd-devel. They are both on the CDs or DVD.
HTML::Tree - Needed by some popular plugins
Time-modules (Time::CTime, Time::DaysInMonth, Time::JulianDay, Time::ParseDate, Time::Timezone) also needed by some popular plugins.
Use debian's package management facilities to install: See instructions on the foswiki web site.
Stick with the platform-specific package management tools 99% of the time. Otherwise, configure CPAN to install in a separate directory (which you can add to $PERL5LIB).
What does o conf make in cpan shell say? Do you have make installed?
Generally, install build-essential (it's in ubuntu, so it should be also in Debian), and then do o conf init in cpan shell.
Consider using CPANPLUS (cpanp script) instead of CPAN.
Consider installing YAML before installing anything else.
Consider setting the configuration to follow prerequisites (that is, when some package requires some other module that is currently missing, it will go ahead and install the other module - recursively as necessary).