Modifying @INC

From: Perldiscuss - Perl Newsgroups And Mailing Lists (shahj_at_india.hp.com)
Date: 07/29/04


Date: 29 Jul 2004 05:14:45 -0000
To: beginners@perl.org

I want to add some paths to the @INC array to resolve certain package
names at runtime.

One of the methods is: "push(@INC,$path) or unshift($path,@INC)" and then
say "require package_name;".
the problem with this is that we still need to use the "::" operator with
the symbols to resolve the package namespace.
eg: package_name::test_sub();

The other method that I came across was to use the PERL5LIB/ PERLLIB
environment variable. This actually needs us to create an OS level env
variable, which I would like to avoid.

Apart from these is there a method that can modify @INC at runtime.



Relevant Pages

  • Re: why debian - longer
    ... does not preclude one from learning how to resolve issues. ... spending hours fixing problem A, fixing problem B, fixing problem C, fixing ... The absense of a package ... manager does not instantly qualify someone to resolve any issue. ...
    (Debian-User)
  • RE: Modifying @INC
    ... > with the symbols to resolve the package namespace. ... "use lib" pragma in conjunction with the FindBin module to locate your ... avoid hard-coding entries into @INC. ...
    (perl.beginners)
  • Re: Redefined label and hyperref error
    ... through pdfLaTeX twice (to resolve the reference), ... package that almost-but-not-quite did what I wanted, ...
    (comp.text.tex)
  • YUM ERROR
    ... Could anyone please help me to resolve following error: ... needed by package mplayer-gui ...
    (comp.os.linux.misc)
  • Re: pst-knot-doc.tex compilation problem
    ... Package xcolor Error: Undefined color `colKeys'. ... how do you resolve the colKeys definition ... resulted in a missing Reference section (and perhaps missing Index ...
    (comp.text.tex)