?
Solved

Can I change the value of @INC array?

Posted on 2005-04-06
15
Medium Priority
?
281 Views
Last Modified: 2010-03-05
I've installed the modules and they're installed in /usr/local/lib/perl5/site_perl/5.6.1
but this directory is not included in @INC, so I have to add the line

use lib '/usr/local/lib/perl5/site_perl/5.6.1';

in every script I created and that is very inconvenient. Is there anyway I can add this directory into the @INC array? FYI, I've installed ones once and never had this problems until a few months ago.
Any advice would be very appreciated, thank you very much in advance.
0
Comment
Question by:busakorn
  • 7
  • 5
  • 2
  • +1
15 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 13714489
You could set the PERL5LIB or PERLLIB environment variable
0
 
LVL 85

Expert Comment

by:ozo
ID: 13714518
What is in your @INC if not '/usr/local/lib/perl5/site_perl/5.6.1' ?
0
 
LVL 16

Expert Comment

by:manav_mathur
ID: 13715151
- Do scripts involving other modules installed in the same location also require use lib??
- Can you post the output of
perl -e 'print join "\n",@INC'
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 85

Expert Comment

by:ozo
ID: 13715294
also
perl -v

> FYI, I've installed ones once and never had this problems until a few months ago.
Are the problems with modules you've instaled since a few months ago, or with scripts you've created since a few months ago that use modules you've installed before a few months ago?
0
 

Author Comment

by:busakorn
ID: 13715550
This is my output of perl -e 'print join "\n",@INC'

/usr/local/lib/perl5/5.6.1/i686-linux
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/i686-linux
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
.
0
 

Author Comment

by:busakorn
ID: 13715555
This is for perl -v

This is perl, v5.6.1 built for i686-linux

Copyright 1987-2001, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
0
 

Author Comment

by:busakorn
ID: 13715563
This is the error message when running the script

Can't locate HTML/FormatText.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .)
0
 

Author Comment

by:busakorn
ID: 13715581
Dear ozo,

The problems occured with scripts using the modules I'd installed a few months ago.
And there is no problems with the scripts using the modules I installed before that.

Any clues?
0
 
LVL 85

Expert Comment

by:ozo
ID: 13715664
The @INC reported by the error message does not match the @INC reported by print join "\n",@INC;
Are you sure you are running the same perl in both cases?
0
 
LVL 85

Expert Comment

by:ozo
ID: 13715716
And which perl did you use to install?
0
 
LVL 85

Expert Comment

by:ozo
ID: 13715798
On linux, you should be able to say
which perl

Do your scripts start with a
#!
line?
0
 
LVL 16

Expert Comment

by:manav_mathur
ID: 13715912
Your @INC does contain the required library.

Could you manually try and see whether
/usr/lib/perl5/site_perl/5.6.1/HTML/FormatText.pm
exists??

How did you install this module??
0
 
LVL 48

Expert Comment

by:Tintin
ID: 13721453
I suspect you haven't installed the module correctly.
0
 
LVL 85

Accepted Solution

by:
ozo earned 375 total points
ID: 13721618
I suspect you installed it using a perl with '/usr/local/lib/perl5/site_perl/5.6.1' in its @INC
and tried to run it using a perl without '/usr/local/lib/perl5/site_perl/5.6.1' in its @INC
0
 

Author Comment

by:busakorn
ID: 13883276
Thank you all very much.

I consulted my boss,  he thought adding use lib line is fine,  and I have to move on to do other jobs.
So, thank you very much again.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question