CommaSplice has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all. I'm trying to install a .pm package given to me by a peer. It's not available online publicly, so I need to know how to install module files from a computer desktop into Perl (Perl Strawberry in my case). It was unclear how to do so from previous postings on this website.

Any help is appreciated.

  • Comment on Installing .pm module with Strawberry Perl (Windows)

Replies are listed 'Best First'.
Re: Installing .pm module with Strawberry Perl (Windows)
by holli (Abbot) on Oct 30, 2017 at 17:12 UTC
    Is it a complete distribution (aka tarball) with a makefile? If so, install as usual. Unpack it and then
    > perl Makefile.pl > make > make test > make install
    In case of it being just a .pm file, just copy it anywhere where perl is looking ( @INC ).
    perl -e 'print join "\n", @INC;'
    Or create "lib" directory next to your script and
    use lib "lib";


    holli

    You can lead your users to water, but alas, you cannot drown them.

      just copy it anywhere where perl is looking ( @INC ).

      No, place it here in the directory output by the following:

      perl -V:installsitelib

      Or create "lib" directory next to your script and use lib "lib";

      No, that won't always work before 5.26 (because it assumes the CWD is the script's directory), and it introduces a security vulnerability in setuid scripts. You want:

      use FindBin qw( $RealBin ); use lib "$RealBin/lib";
      perl -e "print join "\n", @INC;

      Are you sure double quotes can be nested?

      perl -e "print join qq(\n), @INC"

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        Fixed. It's a pita. Too many shells with differing quoting mechanisms :)


        holli

        You can lead your users to water, but alas, you cannot drown them.
Re: Installing .pm module with Strawberry Perl (Windows)
by Discipulus (Canon) on Oct 30, 2017 at 17:17 UTC
    Hello CommaSplice,

    If the modules is a pure Perl one (no XS code) and was not packaged at all to be distributed you simply put thw .pm file in the appropriate directory that for a strawberry perl installation can be similar to c:\strawberryperl\site\lib

    If the module just define a package like MyNewShinyMod the above path will be enough. By other hand if the module define a package like My::NewShinyMod you need to create a folder named My in the above path and put the .pm file there.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.