How do I specify @INC during CPAN module installation?

Discussion in 'Perl Misc' started by ethandbrown@gmail.com, Dec 6, 2006.

  1. Guest

    Hi Group--

    I'm having trouble deploying some code on my webhost's server because
    of module incompatibilities. I'm able to install the latest CPAN
    modules in my own account space, but I'm running into compatibility
    issues because the default modules installed in the system directories
    can be out of date with respect to the newer modules I'm installing.

    I'd like to cleanly install the most current set of modules in my own
    account space, but I'm not sure how to tell the CPAN module to consider
    only my module path during its builds so that the newest dependent
    modules are also installed (and the system modules are ignored). In my
    own programs I can just set:

    @INC = ("/home/myaccount/myperllibs/lib");

    but I'm unclear as to how to do this while running "perl -MCPAN -e
    shell"

    I've reviewed the CPAN docs and saw "How to install modules in your own
    space", but they don't make mention of specifying a custom "@INC" while
    doing it (or I just missed it).

    Help is appreciated. Thanks,

    --Ethan
     
    , Dec 6, 2006
    #1
    1. Advertising

  2. Guest

    Sherm Pendley wrote:
    > "" <> writes:
    >
    > > I'd like to cleanly install the most current set of modules in my own
    > > account space, but I'm not sure how to tell the CPAN module to consider
    > > only my module path during its builds so that the newest dependent
    > > modules are also installed (and the system modules are ignored). In my
    > > own programs I can just set:
    > >
    > > @INC = ("/home/myaccount/myperllibs/lib");
    > >
    > > but I'm unclear as to how to do this while running "perl -MCPAN -e
    > > shell"

    >
    > You can prepend to @INC with the -I switch, like this:
    >
    > perl -I/home/myaccount/myperllibs/lib -MCPAN -e shell
    >
    > You could also set the PERL5LIB environment variable. The syntax for that
    > is dependent on the shell you're using - for bash it would be:
    >
    > export PERL5LIB=/home/myaccount/myperllibs/lib
    >
    > Have a look at "perldoc perlrun" for details.
    >
    > sherm--
    >


    Hi Sherm--

    Thanks for the quick response. Unfortunately, both of these
    suggestions just add another entry into the @INC list, rather than
    removing the system module directories. Here's an example dump after
    using the "export" method:
    ---------------------------------------------------
    ethan@strider:~$ export PERL5LIB=/home/myaccount/myperllibs/lib
    ethan@strider:~$ perl -e 'print "@INC\n"'
    /home/myaccount/myperllibs/lib /etc/perl /usr/local/lib/perl/5.8.7
    /usr/local/share/perl/5.8.7 /usr/lib/perl5 /usr/share/perl5
    /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .
    ethan@strider:~$
    ---------------------------------------------------

    To reiterate my original request, I need the CPAN build process to
    ignore the default system module directories.

    Again, thank you for your time in replying to my request.

    --Ethan
     
    , Dec 6, 2006
    #2
    1. Advertising

  3. J.D. Baldwin Guest

    In the previous article, <>
    wrote:
    > I'd like to cleanly install the most current set of modules in my
    > own account space, but I'm not sure how to tell the CPAN module to
    > consider only my module path during its builds so that the newest
    > dependent modules are also installed (and the system modules are
    > ignored). In my own programs I can just set:
    >
    > @INC = ("/home/myaccount/myperllibs/lib");
    >
    > but I'm unclear as to how to do this while running "perl -MCPAN -e
    > shell"


    Well, there's always

    perl -MCPAN -e 'BEGIN { @INC = ("/home/myaccount/myperllibs/lib") } shell'

    but replacing all of @INC is (as pointed out elsewhere) a Bad Idea.

    > I've reviewed the CPAN docs and saw "How to install modules in your
    > own space", but they don't make mention of specifying a custom
    > "@INC" while doing it (or I just missed it).


    When dealing routinely with non-system modules, I set and export
    PERL5LIB like so (sh-like shell):

    PERL5LIB="/home/myaccount/myperllibs/lib"
    export PERL5LIB
    perl -M...<whatever>

    Also see "use lib" in, for example,

    http://www.webreference.com/programming/perl/modules/3.html
    --
    _+_ From the catapult of |If anyone disagrees with any statement I make, I
    _|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
    \ / |to deny under oath that I ever made it. -T. Lehrer
    ***~~~~-----------------------------------------------------------------------
     
    J.D. Baldwin, Dec 6, 2006
    #3
  4. Ben Morrow Guest

    Quoth "" <>:
    > Hi Group--
    >
    > I'm having trouble deploying some code on my webhost's server because
    > of module incompatibilities. I'm able to install the latest CPAN
    > modules in my own account space, but I'm running into compatibility
    > issues because the default modules installed in the system directories
    > can be out of date with respect to the newer modules I'm installing.
    >
    > I'd like to cleanly install the most current set of modules in my own
    > account space, but I'm not sure how to tell the CPAN module to consider
    > only my module path during its builds so that the newest dependent
    > modules are also installed (and the system modules are ignored). In my
    > own programs I can just set:
    >
    > @INC = ("/home/myaccount/myperllibs/lib");
    >
    > but I'm unclear as to how to do this while running "perl -MCPAN -e
    > shell"


    Well,

    perl -e'BEGIN { @INC = ("...") } use CPAN; shell'

    is the answer to your question as asked, but I believe you have received
    a more useful solution to your problem (use the 'upgrade' command)
    downthread. Apart from anything else, the above will almost certainly
    fail due to not being able to find CPAN.pm itself.

    Ben

    --
    "If a book is worth reading when you are six, *
    it is worth reading when you are sixty." [C.S.Lewis]
     
    Ben Morrow, Dec 6, 2006
    #4
  5. Guest

    Ben Morrow wrote:
    > Quoth "" <>:
    > > Hi Group--
    > >
    > > I'm having trouble deploying some code on my webhost's server because
    > > of module incompatibilities. I'm able to install the latest CPAN
    > > modules in my own account space, but I'm running into compatibility
    > > issues because the default modules installed in the system directories
    > > can be out of date with respect to the newer modules I'm installing.
    > >
    > > I'd like to cleanly install the most current set of modules in my own
    > > account space, but I'm not sure how to tell the CPAN module to consider
    > > only my module path during its builds so that the newest dependent
    > > modules are also installed (and the system modules are ignored). In my
    > > own programs I can just set:
    > >
    > > @INC = ("/home/myaccount/myperllibs/lib");
    > >
    > > but I'm unclear as to how to do this while running "perl -MCPAN -e
    > > shell"

    >
    > Well,
    >
    > perl -e'BEGIN { @INC = ("...") } use CPAN; shell'
    >
    > is the answer to your question as asked, but I believe you have received
    > a more useful solution to your problem (use the 'upgrade' command)
    > downthread. Apart from anything else, the above will almost certainly
    > fail due to not being able to find CPAN.pm itself.
    >
    > Ben
    >


    Thanks Ben. I was planning on installing the latest CPAN in my
    workspace first :).

    I'll try it the "right" way, with 'upgrade' and see how that works out.
    Thanks to all for their time and patience in responding to my
    question.

    --Ethan
     
    , Dec 8, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lin ying
    Replies:
    4
    Views:
    108
    Gunnar Hjalmarsson
    Dec 28, 2003
  2. Justin Wyllie
    Replies:
    5
    Views:
    242
    Peter Pan
    Jan 11, 2005
  3. carl d.
    Replies:
    1
    Views:
    387
    A. Sinan Unur
    May 10, 2005
  4. Niall
    Replies:
    6
    Views:
    231
    Andy Hassall
    Jul 3, 2005
  5. Replies:
    3
    Views:
    1,642
Loading...

Share This Page