Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How do I specify @INC during CPAN module installation?

Reply
Thread Tools

How do I specify @INC during CPAN module installation?

 
 
ethandbrown@gmail.com
Guest
Posts: n/a
 
      12-06-2006
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

 
Reply With Quote
 
 
 
 
ethandbrown@gmail.com
Guest
Posts: n/a
 
      12-06-2006
Sherm Pendley wrote:
> "(E-Mail Removed)" <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
 
J.D. Baldwin
Guest
Posts: n/a
 
      12-06-2006

In the previous article, http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)>
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/programm...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
\ / (E-Mail Removed)|to deny under oath that I ever made it. -T. Lehrer
***~~~~-----------------------------------------------------------------------
 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a
 
      12-06-2006

Quoth "(E-Mail Removed)" <(E-Mail Removed)>:
> 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, * (E-Mail Removed)
it is worth reading when you are sixty." [C.S.Lewis]
 
Reply With Quote
 
ethandbrown@gmail.com
Guest
Posts: n/a
 
      12-08-2006
Ben Morrow wrote:
> Quoth "(E-Mail Removed)" <(E-Mail Removed)>:
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
rt.cpan.org, search.cpan.org: why so unuseable? Ben Bullock Perl Misc 12 07-08-2008 12:51 PM
Is there a better way to search CPAN than search.cpan.org? usenet@DavidFilmer.com Perl Misc 5 10-12-2005 04:50 AM
Problems locating C++ compiler / linker / make during installation of a module via CPAN Niall Perl Misc 6 07-03-2005 10:50 AM
Upgrading to CPAN.pm v1.76 install Bundle::CPAN fails carl d. Perl Misc 1 05-10-2005 09:35 PM



Advertisments