Search code examples
perlcpan

How to build and install local Perl modules


How does one build and install a local Perl module? I downloaded the code for a module that won't compile as-is so I mucked around in the code. I'd like to build it and install it. I sort of have the build down using the makefile although I would like to know how to specify "osname" in the makefile. So a .pm and .bundle file are created. I tried to do a make install but from what I see that neither file was installed in the proper location. I am doing this on a MacOS system and I have perlbrew installed. Every post I see for installing modules only discuss using cpan to install from the remote cpan repository. I'll have to post another question on why so many modules I attempt to install as-is fail, grrrrr.


Solution

  • If it has a Build.PL:

    perl Build.PL
    ./Build test
    ./Build install
    

    Otherwise:

    perl Makefile.PL
    make test
    make install
    

    (This assumes all dependencies are installed.)