Perldoc Search: "@INC" perl-5.20.1

search official POD


12 PODs, 42 LINEs found.
perlfunc.pod
727 :         except that it's more concise, runs no external processes, keeps track of the current filename for error messages, searches the @INC directories, and updates %INC if the file is found. See "@INC" in perlvar and "%INC" in perlvar for these variables. It also differs in that code evaluated with "do FILENAME" cannot see lexicals in the enclosing scope; "eval STRING" does. It's the same, however, in that it does reparse the file every time you call it, so you probably don't want to do this inside a loop.
2932 :                 foreach $prefix (@INC) {
2956 :                 croak "Can't locate $filename in \@INC ...";
2969 :         The require function will actually look for the "Foo/Bar.pm" file in the directories specified in the @INC array.
2978 :         The require function will look for the "Foo::Bar" file in the @INC array and will complain about not finding "Foo::Bar" there. In this case you can do:
2984 :         You can also insert hooks into the import facility by putting Perl code directly into the @INC array. There are three forms of hooks: subroutine references, array references, and blessed objects.
2986 :         Subroutine references are the simplest case. When the inclusion system walks through @INC and encounters a subroutine, this subroutine gets called with two parameters, the first a reference to itself, and the second the name of the file to be included (e.g., "Foo/Bar.pm"). The subroutine should return either nothing or else a list of up to four values in the following order:
2996 :         If an empty list, "undef", or nothing that matches the first 3 values above is returned, then "require" looks at the remaining elements of @INC. Note that this filehandle must be a real filehandle (strictly a typeglob or reference to a typeglob, whether blessed or unblessed); tied filehandles will be ignored and processing will stop there.
3002 :             push @INC, \&my_sub;
3010 :             push @INC, [ \&my_sub, $x, $y, ... ];
3029 :             push @INC, Foo->new(...);
3043 :         Resetting "A-Z" is not recommended because you'll wipe out your @ARGV and @INC arrays and your %ENV hash. Resets only package variables; lexical variables are unaffected, but they clean themselves up on scope exit anyway, so you'll probably want to use them instead. See "my".
perlrun.pod
243 :          Perl can be built so that it by default will try to execute $Config{sitelib}/sitecustomize.pl at startup (in a BEGIN block). This is a hook that allows the sysadmin to customize how Perl behaves. It can for instance be used to add entries to the @INC array to make Perl find modules in non-standard locations.
256 :          The code is executed *very* early. For example, any changes made to @INC will show up in the output of `perl -V`. Of course, "END" blocks will be likewise executed very late.
352 :          Directories specified by -I are prepended to the search path for modules (@INC).
452 :     -V   prints summary of the major perl configuration values and the current values of @INC.
518 :     PERL5OPT    Command-line options (switches). Switches in this variable are treated as if they were on every Perl command line. Only the -[CDIMUdmtwW] switches are allowed. When running taint checks (either because the program was running setuid or setgid, or because the -T or -t switch was used), this variable is ignored. If PERL5OPT begins with -T, tainting will be enabled and subsequent options ignored. If PERL5OPT begins with -t, tainting will be enabled, a writable dot removed from @INC, and subsequent options honored.
648 :                 A translation-concealed rooted logical name that contains Perl and the logical device for the @INC path on VMS only. Other logical names that affect Perl on VMS include PERLSHR, PERL_ENV_TABLES, and SYS$TIMEZONE_DIFFERENTIAL, but are optional and discussed further in perlvms and in README.vms in the Perl source distribution.
perlport.pod
562 :     The value of $^O on OpenVMS is "VMS". To determine the architecture that you are running on without resorting to loading all of %Config you can examine the content of the @INC array like so:
564 :         if (grep(/VMS_AXP/, @INC)) {
567 :         } elsif (grep(/VMS_VAX/, @INC)) {
570 :         } elsif (grep(/VMS_IA64/, @INC)) {
605 :     The value of $^O on VOS is "vos". To determine the architecture that you are running on without resorting to loading all of %Config you can examine the content of the @INC array like so:
perlsec.pod
130 :   Taint mode and @INC
131 :     When the taint mode ("-T") is in effect, the "." directory is removed from @INC, and the environment variables "PERL5LIB" and "PERLLIB" are ignored by Perl. You can still adjust @INC from outside the program by using the "-I" command line option as explained in perlrun. The two environment variables are ignored because they are obscured, and a user running a program could be unaware that they are set, whereas the "-I" option is clearly visible and therefore permitted.
133 :     Another way to modify @INC without modifying the program, is to use the "lib" pragma, e.g.:
139 :     Note that if a tainted string is added to @INC, the following problem will be reported:
perlvms.pod
30 :     Finally, you'll need to copy the extension's Perl library module to the [.*Extname*] subdirectory under one of the directories in @INC, where *Extname* is the name of the extension, with all "::" replaced by "." (e.g. the library module for extension Foo::Bar would be copied to a [.Foo.Bar] subdirectory).
46 :     *   the [.Lib.Auto.*Arch**$PVers**Extname*] subdirectory of one of the directories in @INC (where *PVers* is the version of Perl you're using, as supplied in $], with '.' converted to '_'), or
48 :     *   one of the directories in @INC, or
perlmodinstall.pod
12 :     If you don't see an error message, you have the module. (If you do see an error message, it's still possible you have the module, but that it's not in your path, which you can display with "perl -e "print qq(@INC)"".) For the remainder of this document, we'll assume that you really honestly truly lack an installed module, but have found it on the CPAN.
23 :     Also note that these instructions are tailored for installing the module into your system's repository of Perl modules, but you can install modules into any directory you wish. For instance, where I say "perl Makefile.PL", you can substitute "perl Makefile.PL PREFIX=/my/perl_directory" to install the modules into /my/perl_directory. Then you can use the modules from your Perl programs with "use lib "/my/perl_directory/lib/site_perl";" or sometimes just "use "/my/perl_directory";". If you're on a system that requires superuser/root access to install modules into the directories you see when you type "perl -e "print qq(@INC)"", you'll want to install them into a local directory (such as your home directory) and use this approach.
128 :         Then move the files (probably just the .pm files, though there may be some additional ones, too; check the module documentation) to their final destination: This will most likely be in "$ENV{MACPERL}site_lib:" (i.e., "HD:MacPerl folder:site_lib:"). You can add new paths to the default @INC in the Preferences menu item in the MacPerl application ("$ENV{MACPERL}site_lib:" is added automagically). Create whatever directory structures are required (i.e., for "Some::Module", create "$ENV{MACPERL}site_lib:Some:" and put "Module.pm" in that directory).
perldiag.pod
480 :         (F) You said to "do" (or "require", or "use") a file that couldn't be found. Perl looks for the file in all the locations mentioned in @INC, unless the file name included the full path to the file. Perhaps you need to set the PERL5LIB or PERL5OPT environment variable to say where the extra library is, or maybe the script needs to add the library name to @INC. Or maybe you just misspelled the name of the file. See "require" in perlfunc and lib.
482 :     Can't locate auto/%s.al in @INC
485 :     Can't locate loadable object for module %s in @INC
perlvar.pod
214 :     @INC    The array @INC contains the list of places that the "do EXPR", "require", or "use" constructs look for their library files. It initially consists of the arguments to any -I command-line switches, followed by the default Perl library, probably /usr/local/lib/perl, followed by ".", to represent the current directory. ("." will not be appended if taint checks are enabled, either by "-T" or by "-t".) If you need to modify this at runtime, you should use the "use lib" pragma to get the machine-dependent library properly loaded also:
219 :             You can also insert hooks into the file inclusion system by putting Perl code directly into @INC. Those hooks may be subroutine references, array references or blessed objects. See "require" in perlfunc for details.
perlpodspec.pod
581 :     *   At time of writing, "L<name>" values are of two types: either the name of a Pod page like "L<Foo::Bar>" (which might be a real Perl module or program in an @INC / PATH directory, or a .pod file in those places); or the name of a Unix man page, like "L<crontab(5)>". In theory, "L<chmod>" in ambiguous between a Pod page called "chmod", or the Unix man page "chmod" (in whatever man-section). However, the presence of a string in parens, as in "crontab(5)", is sufficient to signal that what is being discussed is not a Pod page, and so is presumably a Unix man page. The distinction is of no importance to many Pod processors, but some processors that render to hypertext formats may need to distinguish them in order to know how to render a given "L<foo>" code.
perlcheat.pod
70 :       10 ctime               10 hinthash    @INC  include paths
perl.pod
256 :      "@INC"                 locations of perl libraries
perlperf.pod
568 :         @data = sort grep { /$filter/ } @incoming
<< Back to Perldoc Search