Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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.

Replies are listed 'Best First'.
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?
[1nickt]: tobyink perl -MTypes::Standard= is_Int -Mstrict -wE 'say 1 if is_Int 1.0'
[jdporter]: so that I can use the existing expand unix util. Otherwise, I'll probably use Text::Tabs.
[1nickt]: pryrt I guess I don;t really care if user 42 logs on as 42.0 ... more of an academic question at this point.
[LanX]: jdporter: open PIPE,'-|' ?
[LanX]: oh you want the result line by line?
[jdporter]: ok, LanX, then what?
[jdporter]: It doesn't have to be line by line. Just "my program" "writes" to the external prog and also/then "reads" from it.
LanX open (You are not allowed to open to a command that pipes both in and out, but see IPC::Open2, IPC::Open3, and Bidirectional Communication with Another Process in perlipc for alternatives.)
[jdporter]: IPC::Open2, I guess
[jdporter]: yes, that

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-05-24 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?