Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: add remote dir to @INC

by jpl (Monk)
on May 25, 2011 at 16:42 UTC ( #906671=note: print w/ replies, xml ) Need Help??


in reply to add remote dir to @INC

The devil is in the details of how you try to modify @INC.

push(@INC, "/my/directory"); use MyModule;
will not work.
use lib "/my/directory"; use MyModule;
should work.

use and BEGIN are evaluated "at compile time", before any other code is executed. So, in the first example use MyModule; is evaluated before @INC has been modified. The second example works because both statements are evaluated at compile time.

The PERL5LIB environment variable is, as was suggested, also useful. It, too, is processed at compile time.


Comment on Re: add remote dir to @INC
Select or Download Code
Re^2: add remote dir to @INC
by kosta (Sexton) on May 25, 2011 at 17:32 UTC
    well that is what I did... I didnt even modify the PERL5LIB environment variable - I just created a symlink to my remote module folder in /System/Library/Perl/Extras/5.10.0. which already is in my INC, this didnt fix the issue however
      ok I got somewhere... maybe you can give me a hand here... when searching for modules "how deep" does perl descend? What happened to me that when I added to INC the whole remote modules folder but when I added site_perl folder (which was descended kinda deep in modules) it started working... Any way to make sure it does a complete recursive search?
        It does not recursively descend through the @INC directories. Read require (which is called by use). There is a slight exception when you use lib (see the 'auto' directory).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://906671]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2014-07-28 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (198 votes), past polls