Perldoc Search: "%ENV" perl-5.20.1

search official POD

14 PODs, 50 LINEs found.
276 :         (W internal) A warning peculiar to VMS. While Perl was preparing to iterate over %ENV, it encountered a logical name or symbol definition which was too long, so it was truncated to the string shown.
497 :     Can't make list assignment to %ENV on this system
498 :         (F) List assignment to %ENV is not supported on some systems, notably VMS.
554 :         (S) A warning peculiar to VMS. Perl tried to read an element of %ENV from the CRTL's internal environment array and discovered the array was missing. You need to figure out where your CRTL misplaced its environ or define PERL_ENV_TABLES (see perlvms) so that environ is not searched.
568 :     Can't reset %ENV on this system
569 :         (F) You called "reset('E')" or similar, which tried to reset all variables in the current package beginning with "E". In the main package, that includes %ENV. Resetting %ENV is not supported on some systems, notably VMS.
926 :     %ENV is aliased to %s
927 :         (F) You're running under taint mode, and the %ENV variable has been aliased to another hash, so it doesn't reflect anymore the state of the program's environment. This is potentially insecure.
1199 :         (W internal) A warning peculiar to VMS. Perl tried to read a logical name or CLI symbol definition when preparing to iterate over %ENV, and didn't see the expected delimiter between key and value, so the line was ignored.
2833 :         (W internal) Warnings peculiar to VMS. You tried to change or delete an element of the CRTL's internal environ array, but your copy of Perl wasn't built with a CRTL that contained the setenv() function. You'll need to rebuild Perl with a CRTL that does, or redefine PERL_ENV_TABLES (see perlvms) so that the environ array isn't the target of the change to %ENV which produced the warning.
3019 :         (P) An error peculiar to VMS. Perl was reading values for %ENV before iterating over it, and someone else stuck a message in the stream of data Perl expected. Someone's very confused, or perhaps trying to subvert Perl's population of %ENV for nefarious purposes.
3421 :         (W misc) A warning peculiar to VMS. Perl tried to read the value of an %ENV element from a CLI symbol table, and found a resultant string longer than 1024 characters. The return value has been truncated to 1024 characters.
356 :     %ENV
357 :         The operation of the %ENV array depends on the translation of the logical name PERL_ENV_TABLES. If defined, it should be a search list, each element of which specifies a location for %ENV elements. If you tell Perl to read or set the element "$ENV{"*name*"}", then Perl uses the translations of PERL_ENV_TABLES as follows:
363 :             A string beginning with "CLISYM_"tells Perl to consult the CLI's symbol tables, using *name* as the name of the symbol. When reading an element of %ENV, the local symbol table is scanned first, followed by the global symbol table.. The characters following "CLISYM_" are significant when an element of %ENV is set or deleted: if the complete string is "CLISYM_LOCAL", the change is made in the local symbol table; otherwise the global symbol table is changed.
368 :         PERL_ENV_TABLES is translated once when Perl starts up; any changes you make while Perl is running do not affect the behavior of %ENV. If PERL_ENV_TABLES is not defined, then Perl defaults to consulting first the logical name tables specified by LNM$FILE_DEV, and then the CRTL "environ" array.
370 :         In all operations on %ENV, the key string is treated as if it were entirely uppercase, regardless of the case actually specified in the Perl expression.
372 :         When an element of %ENV is read, the locations to which PERL_ENV_TABLES points are checked in order, and the value obtained from the first successful lookup is returned. If the name of the %ENV element contains a semi-colon, it and any characters after it are removed. These are ignored when the CRTL "environ" array or a CLI symbol table is consulted. However, the name is looked up in a logical name table, the suffix after the semi-colon is treated as the translation index to be used for the lookup. This lets you look up successive values for search list logical names. For instance, if you say
380 :         When an element of %ENV is set to a defined string, the corresponding definition is made in the location to which the first translation of PERL_ENV_TABLES points. If this causes a logical name to be created, it is defined in supervisor mode. (The same is done if an existing logical name was defined in executive or kernel mode; an existing user or supervisor mode logical name is reset to the new value.) If the value is an empty string, the logical name's translation is defined as a single "NUL" (ASCII "\0") character, since a logical name cannot translate to a zero-length string. (This restriction does not apply to CLI symbols or CRTL "environ" values; they are set to the empty string.) An element of the CRTL "environ" array can be set only if your copy of Perl knows about the CRTL's "setenv()" function. (This is present only in some versions of the DECCRTL; check $Config{d_setenv} to see whether your copy of Perl was built with a CRTL that has this function.)
382 :         When an element of %ENV is set to "undef", the element is looked up as if it were being read, and if it is found, it is deleted. (An item "deleted" from the CRTL "environ" array is set to the empty string; this can only be done if your copy of Perl knows about the CRTL "setenv()" function.) Using "delete" to remove an element from %ENV has a similar effect, but after the element is deleted, another attempt is made to look up the element, so an inner-mode logical name or a name in another location will replace the logical name just deleted. In either case, only the first value found searching PERL_ENV_TABLES is altered. It is not possible at present to define a search list logical name via %ENV.
395 :         Don't try to clear %ENV by saying "%ENV = ();", it will throw a fatal error. This is equivalent to doing the following from DCL:
401 :         At present, the first time you iterate over %ENV using "keys", or "values", you will incur a time penalty as all logical names are read, in order to fully populate %ENV. Subsequent iterations will not reread logical names, so they won't be as slow, but they also won't reflect any changes to logical name tables caused by other programs.
610 :         Deleting from %ENV modifies the environment. Deleting from a hash tied to a DBM file deletes the entry from the DBM file. Deleting from a "tied" hash or array may not necessarily return anything; it depends on the implementation of the "tied" package's DELETE method, which may do whatever it pleases.
777 :             while (($key,$value) = each %ENV) {
787 :             while(each %ENV) {
1496 :             @keys = keys %ENV;
1497 :             @values = values %ENV;
1504 :             foreach $key (sort(keys %ENV)) {
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".
449 :        my $env = pack( '(A*A*Z*)' . keys( %Env ) . 'C',
450 :                        map( { ( $_, '=', $Env{$_} ) } keys( %Env ) ), 0 );
457 :        my %env = map( split( /=/, $_ ), unpack( "(Z*)$n", $env ) );
464 :        my $env = pack( 'S(S/A* S/A*)*', scalar keys( %Env ), %Env );
468 :        my %env = unpack( 'S/(S/A* S/A*)', $env );
214 :     Don't count on a specific environment variable existing in %ENV. Don't count on %ENV entries being case-sensitive, or even case-preserving. Don't try to clear %ENV by saying "%ENV = ();", or, if you really have to, make it conditional on "$^O ne 'VMS'" since in VMS the %ENV table is much more than a per-process key-value string table.
216 :     On VMS, some entries in the %ENV hash are dynamically created when their key is used on a read if they did not previously exist. The values for $ENV{HOME}, $ENV{TERM}, $ENV{HOME}, and $ENV{USER}, are known to be dynamically generated. The specific names that are dynamically generated may vary with the version of the C library on VMS, and more may exist than is documented.
218 :     On VMS by default, changes to the %ENV hash are persistent after the process exits. This can cause unintended issues.
715 :     As implied above, the environment accessed through %ENV is global, and the convention is that program specific environment variables are of the form "Program$Name". Each filesystem maintains a current directory, and the current filesystem's current directory is the global current directory. Consequently, sociable programs don't change the current directory but rely on full pathnames, and programs (and Makefiles) cannot assume that they can spawn a child process which can change the current directory without affecting its parent (and everyone else for that matter).
763 :      E  PERL_MAGIC_env            vtbl_env       %ENV hash
764 :      e  PERL_MAGIC_envelem        vtbl_envelem   %ENV hash element
186 :     %ENV    The hash %ENV contains your current environment. Setting a value in "ENV" changes the environment for any child processes you subsequently "fork()" off.
188 :             As of v5.18.0, both keys and values stored in %ENV are stringified.
42 :     This behavior preserves compatibility with earlier versions of Perl, which allowed byte semantics in Perl operations only if none of the program's inputs were marked as being a source of Unicode character data. Such data may come from filehandles, from calls to external programs, from information provided by the system (such as %ENV), or from literals and constants in the source text.
688 :     *   %ENV
148 :         delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};   # Make %ENV safer
17 :     As you see from those examples, "STDOUT" and "STDERR" are output handles, and "STDIN" and "ARGV" are input handles. They are in all capital letters because they are reserved to Perl, much like the @ARGV array and the %ENV hash are. Their external associations were set up by your shell.
27 :             $hashref   = \%ENV;
72 :       12 blcks               with EXPR      %ENV  environment
173 :         Just like special scalars and arrays, there are also special hashes. The most well known of these is %ENV which contains environment variables. Read all about it (and other special variables) in perlvar.
27 :     %ENV    Each pseudo-process maintains its own virtual environment. Modifications to %ENV affect the virtual environment, and are only visible within that pseudo-process, and in any processes (or pseudo-processes) launched from it.
<< Back to Perldoc Search