Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to add path to Perl lib?

Hi

I got an error like this: Can't locate bcc.pm in @INC. How can I add a path to the default @INC for Perl in BF.

Thanks
Jirong

0 votes



3 answers

Permanent link
Hi

I got an error like this: Can't locate bcc.pm in @INC. How can I add a path to the default @INC for Perl in BF.

Thanks
Jirong


Hi Jirong,

You might try setting the environment variable PERL5LIB or PERLLIB with the directory of your module. Another option would be to specify the -I option when invoking perl (ex. perl -I/module/dir script.pl) .

bju

0 votes


Permanent link
Hi

I got an error like this: Can't locate bcc.pm in @INC. How can I add a path to the default @INC for Perl in BF.

Thanks
Jirong


There are a few methods for doing this.

1) Add a "require" or "use" pragma providing the full path to the module

require "\usr\etc\modules\bbc"

2) Add the path to @INC using push or unshift. One adds to the end of the list and the other to the front. Which is which I will leave as an exercise to the reader ;-)

unshift @INC, "\some\path"

0 votes


Permanent link
All of the above.

Also, you can add a -I to your perl magic line in the script (that's a capital i in case your font makes it look like a lowercase L like mine does)
for instance:
#!/usr/bin/perl -I/home/rhaig/perllib


Though I prefer the env var route myself as if you're going to include a directory for one script, it's likely that you'll include it for several.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Aug 19 '10, 5:01 p.m.

Question was seen: 12,621 times

Last updated: Aug 19 '10, 5:01 p.m.

Confirmation Cancel Confirm