1

I've found myself on CentOS without root access, and with a very lame Perl that doesn't even have ExtUtils::MakeMaker.

Does there exist something that could produce an archive of a module's dependencies, for my to unwrap into a directory that I could put into @INC?

Lee Goddard
  • 10,680
  • 4
  • 46
  • 63

3 Answers3

2

use App::cpanminus

cd ~/bin
curl -LO http://xrl.us/cpanm
chmod +x cpanm

export ROOT=/some/directory
export PERL5LIB=${ROOT}/lib/perl5

Then, install ExtUtils::MakeMaker and Module::CoreList. You can't do a simple installation because these modules are used by cpanm, and it doesn't look in the unpacked source directory for them. So, get cpanm to download them, and do a semi-manual install. It actually installs three distributions (the above two and ExtUtils::Install), which is why you get to invoke the build mantra three times:

PERL_MM_OPT=INSTALLBASE=$ROOT ./cpanm -L $ROOT --look ExtUtils::MakeMaker Module::CoreList
perl Makefile.PL
make && make install
exit
perl Makefile.PL
make && make install
exit
perl Makefile.PL
make && make install
exit

It unpacks and cds into each distribution's directory successively. At least that's what happens on a bare-bones CentOS 6 install I just happen to have lying around.

After that, you should be able to install your module and its dependencies via

./cpanm -L $ROOT <module name, or url, or tarball goes here>

Look at the cpanm docs for more info.

Diab Jerius
  • 2,310
  • 13
  • 18
0

You could use perlbrew to innstall a full new Perl with user access.

http://perlbrew.pl/

#install perlbrew
wget -O - http://install.perlbrew.pl | bash

# install new perl for youurself
perlbrew install perl-5.16.0
# set aliases
perlbrew switch perl-5.16.0

#reinstall all moodules for new perl http://perlbrew.pl/Reinstall-All-Modules-On-New-Perl.html
perlbrew list-modules | perlbrew exec --with perl-5.16.0 cpanm

#how to install/recompile third party modules
https://github.com/lecstor/DevNotes/wiki/Image-Magick-with-Perlbrew

Regards,

user1126070
  • 5,059
  • 1
  • 16
  • 15
  • 1
    This doesn't answer the question. It tries to solve the same problem in a completely different way that the OP had commented was not acceptable half an hour before the answer was posted. – Quentin Feb 06 '14 at 13:53
0

Download and untar ExtUtils::MakeMaker, create a directory lib under your home directory, install via:

perl Makefile.PL PREFIX=~/lib LIB=~/lib

Now that module is installed I suggest you use local::lib (easy install via the bootstrap method in the documentation) to install modules:

perl -MCPAN -Mlocal::lib -e 'CPAN::install(MIME::Lite)' # Replace MIME::Lite with what you want to install.

Here MIME::Lite gets installed via cpan to your local lib directory. Prelbrew won't take long to set up, and you likely have an easier time of things in the long run.

Edit, too long for comment.

@LeeGee Perhaps I wasn't specific enough.

The method described will allow you to get around the restricted version of perl you have access to, and allow installaton of modules to another location.

If you want to package your app on another machine you could use either PAR or pp to create a standalone package of code & modules, or a stand alone executable.

Failing that Module::ScanDeps will find a scripts dependencies

Dr.Avalanche
  • 1,944
  • 2
  • 28
  • 37
  • Would be nice to know why this was down-voted. It is not an exact answer, but an explanation for down votes is encouraged by the FAQ, I believe. – Lee Goddard Feb 07 '14 at 11:26
  • 1
    @LeeGee I've updated my answer, the update was too long for comments. There's no point expecting people to explain downvotes, even if it is playing by the house rules. – Dr.Avalanche Feb 07 '14 at 13:08