Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: ADD directory to @INC using a string variable

by Laurent_R (Monsignor)
on Sep 23, 2013 at 15:28 UTC ( #1055315=note: print w/ replies, xml ) Need Help??


in reply to ADD directory to @INC using a string variable

Try use lib hardcoded_path_name;. The use directives are executed at compile time, before the variables used in the code are set.

Else you could set your variable in a BEGIN block, just prior to using it.


Comment on Re: ADD directory to @INC using a string variable
Download Code
Replies are listed 'Best First'.
Re^2: ADD directory to @INC using a string variable
by sid9559 (Novice) on Sep 23, 2013 at 15:32 UTC
    I cannot use a hardcoded path, it is a varying path based on the user. $path = user's cwd/somepath/filename.pm Regards, Siddharth
      use lib './somepath/';
      or
      BEGIN { my $path = 'somepath'; push @INC, $path; }
      or why not just let the user set his/her PERL5LIB environment variable?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-29 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls