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

Simple Question about use @INC

by webchalkboard (Scribe)
on May 23, 2005 at 10:24 UTC ( [id://459497]=perlquestion: print w/replies, xml ) Need Help??

webchalkboard has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
Please excuse the simpleness of this question, but can someone just remind me the syntax for including additional paths in your @INC array... I know you can use USE VAR INC 'blabla' or something like that.

Thanks, Tom

Learning without thought is labor lost; thought without learning is perilous. - Confucius
WebChalkboard.com | For the love of art...

Replies are listed 'Best First'.
Re: Simple Question about use @INC
by blazar (Canon) on May 23, 2005 at 10:27 UTC
    You can use @INC just like any other array and do that manually, if you wish. But you'd better
    use lib;
    for that!
      why? what's different?
      --
      jpg
        You will have to put the altering of @INC into a BEGIN{}-block. Otherwise it will happen at runtime and therefore be rather useless.

        Also, use lib qw(path); looks nicer.


        holli, /regexed monk/
Re: Simple Question about use @INC
by holli (Abbot) on May 23, 2005 at 10:30 UTC
    BEGIN{ push @INC, "path"; } or use lib qw(path);


    holli, /regexed monk/

      Note that lib.pm unshift()s the path, and also removes any duplicate entries.

      ihb

      See perltoc if you don't know which perldoc to read!

Re: Simple Question about use @INC
by polettix (Vicar) on May 23, 2005 at 10:32 UTC
    uselib, Luke...

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.
Re: Simple Question about use @INC
by aukjan (Friar) on May 23, 2005 at 12:31 UTC

    Or you can always set your PERL5LIB environment variable... :)

    .:| If it can't be fixed .. Don't break it |:.

Re: Simple Question about use @INC
by kprasanna_79 (Hermit) on May 23, 2005 at 10:58 UTC
    Hello Webchalkboard,
    I usually do this way to push my path to @INC. I think this helps u. And also i have seen in many samples codes and web examples using this way.
    BEGIN { unshift @INC,"path"; }
    Please ignore typos...
    --Prasanna.K

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://459497]
Approved by castaway
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-19 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found