in reply to What Makefiles do

If I get a CPAN module which only contains one .pl file, why do I need a Makefile along with it? Why wouldn't it be enough just installing the .pl file in a directory, and making sure that directory is in @INC?

I think you mean to say .pm file. You can just copy a .pm to some directory in @INC and it will work. That is what I do because my company doesn't keep Perl modules in a place that Perl knows anything about.

If the module has C code in there, this won't work, but you already said you aren't talking about those modules.

Replies are listed 'Best First'.
Re^2: What Makefiles do
by clscott (Friar) on Nov 09, 2006 at 14:43 UTC

    That is what I do because my company doesn't keep Perl modules in a place that Perl knows anything about.

    If you provide the PREFIX variable to the perl Makefile.PL command you can install a module anywhere you want using the standard process. e.g

    perl Makefile.PL PREFIX=/my/custom/INC/dir/ make make test make install

    This hasn't always worked exactly as planned but it has worked for me for many years. I never install modules into the OS perl distribution and always install modules in my home directory when I'm on a system where I can't install another perl distribution or don't have root priveleges.

    Refer to the perlmodinstall man/perldoc page http://perldoc.perl.org/perlmodinstall.html

    CPAN and CPANPLUS can be configured to use this PREFIX by default so that you can install modules in your special place as easily as into the distribution. Just refer to their documentation.

    --
    Clayton

      I am paranoid about running a makefile that I did not write and know nothing about do something to an important directory. I would rather set PREFIX=/tmp/sandbox and then go check in sandbox and copy the files to /net/production/perl/lib myself.

      The point I want to make is that Perl does not really care how the files got there, so long as @INC is set correctly and the files are in there.

      when I'm on a system where I can't install another perl distribution or don't have root privileges

      why talk about root. A user lile perlinstall is fine. I am actually paranoid about doing make install as root...especially when you don't need it.