FAQ
For those who want/need to install a Perl app or extension without perturbing the default perl library tree.
Possible reasons:
1. Disambiguating the existing libs from your libs (for testing perhaps)
2. Not wanting to or not having rights to login as a supervisor (or as a user with admin rights)
3. Prefer to encapsulate resources in a local tree (easy to move / remove, or whatever reason)
4. Yet another reason I may have overlooked

lessons learned are:
a. utilize the 'LIB= argument when creating your makefile
example: perl Makefile.PL LIB=/users/george/myperlprogram/lib/
b. avoid the temptation to tweak @INC (purported to make use of that library location)
...and instead utilize 'use lib'
example: in MathServer.pm and MathClient.pm (for my projects purposes)
use MathSystem
becomes
use lib MathSystem

c. then we discovered an even better way is:
example: perl Makefile.PL LIB="./lib/" ## ie. use a relative path...
which makes it OK to :
use MathSystem ## no need for 'use lib MathSystem'


Resulting benefits: No need for admin rights to install, no need to push a path onto @INC at runtime

Search Discussions

  • Sean finnigan at Nov 1, 2002 at 7:40 pm
    Thank you.
    George Szynal wrote:For those who want/need to install a Perl app or extension without perturbing the default perl library tree.
    Possible reasons:
    1. Disambiguating the existing libs from your libs (for testing perhaps)
    2. Not wanting to or not having rights to login as a supervisor (or as a user with admin rights)
    3. Prefer to encapsulate resources in a local tree (easy to move / remove, or whatever reason)
    4. Yet another reason I may have overlooked

    lessons learned are:
    a. utilize the 'LIB= argument when creating your makefile
    example: perl Makefile.PL LIB=/users/george/myperlprogram/lib/
    b. avoid the temptation to tweak @INC (purported to make use of that library location)
    ....and instead utilize 'use lib'
    example: in MathServer.pm and MathClient.pm (for my projects purposes)
    use MathSystem
    becomes
    use lib MathSystem

    c. then we discovered an even better way is:
    example: perl Makefile.PL LIB="./lib/" ## ie. use a relative path...
    which makes it OK to :
    use MathSystem ## no need for 'use lib MathSystem'


    Resulting benefits: No need for admin rights to install, no need to push a path onto @INC at runtime



    ---------------------------------
    Do you Yahoo!?
    HotJobs - Search new jobs daily now
  • Michael G Schwern at Nov 7, 2002 at 12:48 am

    On Fri, Nov 01, 2002 at 11:15:15AM -0800, George Szynal wrote:
    For those who want/need to install a Perl app or extension without perturbing the default perl library tree.
    Possible reasons:
    1. Disambiguating the existing libs from your libs (for testing perhaps)
    2. Not wanting to or not having rights to login as a supervisor (or as a user with admin rights)
    3. Prefer to encapsulate resources in a local tree (easy to move / remove, or whatever reason)
    4. Yet another reason I may have overlooked

    lessons learned are:
    a. utilize the 'LIB= argument when creating your makefile
    example: perl Makefile.PL LIB=/users/george/myperlprogram/lib/
    This is due to bugs in MakeMaker prior to 6.XX (ie. what comes with perl
    prior to 5.8.0). The proper thing to use is PREFIX, not LIB. PREFIX
    covers *all* files installed by MakeMaker: libraries, programs,
    documentation, etc... LIB only effects where libraries go. Bugs in old
    versions of MakeMaker meant PREFIX was often ignored, these have been fixed
    and new versions of MakeMaker are available as stand-alone modules (ie. you
    don't have to upgrade perl) from CPAN.

    Since many people still use the old MakeMaker, you can cover your bases by
    specifying both PREFIX and LIB

    perl Makefile.PL PREFIX=foo/bar/ LIB=foo/bar/lib/

    You might also have to specify the INSTALLMAN3DIR, INSTALLMAN1DIR,
    INSTALLBIN and INSTALLSCRIPT to cover man pages and programs installed.
    There's a lot of voodoo involved as to when the bug manifests itself.

    Sorry for the inconvenience.


    --

    Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/
    Perl Quality Assurance <perl-qa@perl.org> Kwalitee Is Job One
    It's Ecstacy time!

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedNov 1, '02 at 7:15p
activeNov 7, '02 at 12:48a
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase