0

WE have perl at work, but I do nt have install permissions on the machines. So i would like to dowload tar files of modules that I want, and build them in a directory of my choosing. However I do not have Makefile.PL or Build.PL. How do I proceed ?

$ which Makefile.PL
/usr/bin/which: no Makefile.PL in ()
$ which Build.PL
/usr/bin/which: no Build.PL in ()
capser
  • 2,442
  • 5
  • 42
  • 74

1 Answers1

5

The utility which (a shell-builtin on my system)

shows the full path of (shell) commands

So it can query the location of installed programs, like ls or cd, and it also will show whether a command is, in fact, a shell command. Try which echo for instance.

Files Makefile.PL and/or Build.PL come with a distribution, not with Perl. They are not programs installed on the system, and even when they are there which cannot find them.

Make sure to read the documentation with the distribution, in tne particular instructions for how to install it, but you'll start with perl Makefile.PL or perl Build.PL. For example, once you found the file Makefile.PL in the unpacked distribution, a typical process consists of running

perl Makefile.PL
make
make test
make install

A quick search reveals this guide on perlmonks. There is a lot more out there.

The Build.PL is generally associated with Module::Build, and an installation outline is the same as above except that you use ./Build instead of make. With it you don't need to even have make.

This approach is an alternative to ExtUtils::MakeMaker, which uses Makefile.PL . Comparing these two major alternatives is tricky and I'd rather not get into that. The Module::Build can also generate the file Makefile.PL. Both files may be provided so that one can use either method, and this decision itself is a topic of discussions.

As for whether to use Makefile.PL or Build.PL for your install, I suggest to find discussions of the module, starting with its own docs, and see which one people recommend for that distribution. Most often either is fine.

Another related common type of file is Makefile (no extension). This is run by the program make, and often without arguments (make finds the Makefile). The first command above writes one such file out, and then the remaining make commands use it to trigger actions that build (+test+install) the module.

Have you considered using cpan or cpanm instead? You can use them to install stuff as a user into a directory of your choosing. See, for instance, this post and this post.

Or, consider perlbrew for a fully contained Perl with all chosen modules, insulated from any future management of the system perl.

zdim
  • 64,580
  • 5
  • 52
  • 81
  • @capser Added a comment on what I forgot to mention in the end -- you can install modules as a user into any directory using cpan/cpanm, and it's really simple. On the other hand, consider having a whole Perl of your liking installed using perlbrew. Then you can have all the modules you want with that Perl. That way you're protected from changes to system's perl. – zdim Oct 04 '17 at 18:35