Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: How to add a file to @INC path in perl

by prafulltc (Acolyte)
on Aug 31, 2011 at 07:24 UTC ( #923370=note: print w/replies, xml ) Need Help??


in reply to Re: How to add a file to @INC path in perl
in thread How to add a file to @INC path in perl



with -I option , you can add files to @INC at run time.
#!/usr/bin/perl -I/path-to-new-library/


Regrds,
Prafull

Replies are listed 'Best First'.
Re^3: How to add a file to @INC path in perl
by ikegami (Pope) on Aug 31, 2011 at 07:26 UTC
    That's actually before compile-time. Good thing too, because it would be useless to change @INC at run time.

      I change @INC at run-time all the time.

      What you're probably confused about is that 'use Some::Module' normally happens at compile-time (actually it happens in a virtual BEGIN block) and that is how most people interact with @INC. However, you can defer useing modules by doing it in a string-eval, or you can use require, or do.

      And there are all kinds of evil tricks you can play by putting code-refs into @INC.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2020-11-30 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?