Friday, January 10, 2014

Install Perl Module from Local Repository

Perl Module installation is Fun, but fun ends when we deal with hundreds of perl modules. One of the best things about Perl is that they are available on CPAN. But we can't trust that type of installation since it installs only new releases and you never know that version of module will bring a bug that breaks your application.

So I used to keep my version of perl modules and installs it one by one, but it was really time consuming. Then I found a tool called Pinto which allows us to create our own local perl repository.

Here I will explain how to install Pinto as a standalone application and create repository from it.


For installing Pinto issue the below command,

curl -L http://getpinto.stratopan.com | bash

source ~/opt/local/pinto/etc/bashrc


Create a Repository named 'repo' in the /opt folder,

pinto -r /opt/repo init


List the Modules inside the repository by the following command,

pinto -r /opt/repo list


Add CPAN Modules as follows,

pinto -r /opt/repo pull URI


Upgrade Modules from CPAN,

pinto -r /opt/repo pull URI~1.62


Add Private Modules,

pinto -r /opt/repo add path/to/My-Module-1.0.tar.gz


Delete Modules from the repository,

pinto -r /opt/repo delete GAAS/URI-1.60.tar.gz


Register Modules to the repository (For deleted modules),

We need to Register the deleted Module inorder to add that Module again.

pinto -r /opt/repo register GAAS/URI-1.60.tar.gz


The above steps will create a Repository having all the required Perl Modules. We can use this repo folder in any machine having cpanminus tool.


Install cpanm tool as follows,

First install dependencies..

cpan Module::Build ExtUtils::Install

OR

Install these modules in this order,

Perl-OSType-1.006.tar.gz
version-0.9904.tar.gz
Module-Metadata-1.000019.tar.gz
Module-Build-0.4203.tar.gz
ExtUtils-Install-1.54.tar.gz
File-Path-2.09.tar.gz
parent-0.228.tar.gz


Install cpanminus,

tar -zxvf App-cpanminus-1.7001.tar.gz
cd App-cpanminus-1.7001

perl Makefile.PL
make
make install


Now your are ready to install the Perl MOdules from local Repository,

cpanm --mirror=file:/opt/repo/ --mirror-only Module::One Module::two Module::Three





Thanks for reading,
Cheers/-

No comments:

Post a Comment