As the resident "Perlmeister" where I work I wrestle with that question all the time. There are several options that I use depending on the situation:

Some preconditions to consider:

The first thing I have to say to pre-qualify all that I am going to say on this subject is the fact we have a convention where I work that all third party software installed on our supported systems goes into /usr/local/software and each software package goes into its own subdirectory with some sort of revision tag in its name. Example we would put Perl version 5.8 into a subdirectory under /usr/local/software/perl-5.8 with appropriate symbolic links to places like /usr/bin and /usr/lib etc. This makes it real easy to deploy new versions of things onto our supported systems and roll back if necessary and other options.

Application Specific Modules

Keeping that scheme in mind if I or someone on my team has written a module specific to a patricular application then that module is going to get installed in the subdirectory that the application has been installed in. For instance if I have an application called "mailStripper" and its version number is 2.1 then it will get installed in /usr/local/software/mailStripper-2.1 with its modules installed in /usr/local/software/mailStripper-2.1/lib/perl5 and in subdirectories as appropriate. This means that I have to tell the individual scripts for that application where to find its modules. One of many ways of doing this of course is:
use lib qq(/usr/local/software/mailStripper-2.1/lib/perl5);
The weakness of doing that keep in mind is that if I change the version of the application and it gets installed somewhere else I have to make sure I update the use line as appropriate.

Still local, but I don't want to mix it into Perl's installation directory

Still keeping in mind the scheme we are using for installing third party software there are cases where I want to make locally developed modules available to multiple applications. We will install those in a directory /usr/local/software/lib/perl5. Again you need to do the use lib ... thing in scripts using those modules.

Put in with the rest of the modules!

If you really insist on not dealing with putting use lib... in your scripts to get to your modules then you can always do a
perl -e "print join($/,@INC);"
and see where Perl expects to find modules and put your stuff in there. The burden you now have is to keep track of what you put there in the event you upgrade Perl and have to re-install your modules.

TIAMTOWTDI in Perl...


Peter L. Berghold -- Unix Professional
Peter at Berghold dot Net
   Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.

In reply to Re: Where to install my own perl modules? by blue_cowdawg
in thread Where to install my own perl modules? by neilwatson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.