pod updates (from David Adler, M J T Guy)
[p5sagit/p5-mst-13.2.git] / pod / perlvar.pod
index 9402608..dca9cc0 100644 (file)
@@ -45,9 +45,7 @@ you try to assign to this variable, either directly or indirectly through
 a reference, you'll raise a run-time exception.
 
 The following list is ordered by scalar variables first, then the
-arrays, then the hashes (except $^M was added in the wrong place).
-This is somewhat obscured because %ENV and %SIG are listed as
-$ENV{expr} and $SIG{expr}.
+arrays, then the hashes.
 
 =over 8
 
@@ -272,7 +270,7 @@ set, you'll get the record back in pieces.
 On VMS, record reads are done with the equivalent of C<sysread>,
 so it's best not to mix record and non-record reads on the same
 file.  (This is unlikely to be a problem, because any file you'd
-want to read in record mode is probably usable in line mode.)
+want to read in record mode is probably unusable in line mode.)
 Non-VMS systems do normal I/O, so it's safe to mix record and
 non-record reads of a file.
 
@@ -688,6 +686,8 @@ of perl in the right bracket?)  Example:
 See also the documentation of C<use VERSION> and C<require VERSION>
 for a convenient way to fail if the running Perl interpreter is too old.
 
+See C<$^V> for a more modern representation of the Perl version.
+
 =item $COMPILING
 
 =item $^C
@@ -719,8 +719,54 @@ C<$^F> when the open() or pipe() was called, not the time of the exec().
 
 =item $^H
 
-The current set of syntax checks enabled by C<use strict> and other block
-scoped compiler hints.  See the documentation of C<strict> for more details.
+WARNING: This variable is strictly for internal use only.  Its availability,
+behavior, and contents are subject to change without notice.
+
+This variable contains compile-time hints for the Perl interpreter.  At the
+end of compilation of a BLOCK the value of this variable is restored to the
+value when the interpreter started to compile the BLOCK.
+
+When perl begins to parse any block construct that provides a lexical scope
+(e.g., eval body, required file, subroutine body, loop body, or conditional
+block), the existing value of $^H is saved, but its value is left unchanged.
+When the compilation of the block is completed, it regains the saved value.
+Between the points where its value is saved and restored, code that
+executes within BEGIN blocks is free to change the value of $^H.
+
+This behavior provides the semantic of lexical scoping, and is used in,
+for instance, the C<use strict> pragma.
+
+The contents should be an integer; different bits of it are used for
+different pragmatic flags.  Here's an example:
+
+    sub add_100 { $^H |= 0x100 }
+
+    sub foo {
+       BEGIN { add_100() }
+       bar->baz($boon);
+    }
+
+Consider what happens during execution of the BEGIN block.  At this point
+the BEGIN block has already been compiled, but the body of foo() is still
+being compiled.  The new value of $^H will therefore be visible only while
+the body of foo() is being compiled.
+
+Substitution of the above BEGIN block with:
+
+    BEGIN { require strict; strict->import('vars') }
+
+demonstrates how C<use strict 'vars'> is implemented.  Here's a conditional
+version of the same lexical pragma:
+
+    BEGIN { require strict; strict->import('vars') if $condition }
+
+=item %^H
+
+WARNING: This variable is strictly for internal use only.  Its availability,
+behavior, and contents are subject to change without notice.
+
+The %^H hash provides the same scoping semantic as $^H.  This makes it
+useful for implementation of lexically scoped pragmas.
 
 =item $INPLACE_EDIT
 
@@ -786,6 +832,23 @@ Keep info about source lines on which a subroutine is defined.
 
 Start with single-step on.
 
+=item 0x40
+
+Use subroutine address instead of name when reporting.
+
+=item 0x80
+
+Report C<goto &subroutine> as well.
+
+=item 0x100
+
+Provide informative "file" names for evals based on the place they were compiled.
+
+=item 0x200
+
+Provide informative names to anonymous subroutines based on the place they
+were compiled.
+
 =back
 
 Some bits may be relevant at compile-time only, some at
@@ -810,13 +873,73 @@ The time at which the program began running, in seconds since the
 epoch (beginning of 1970).  The values returned by the B<-M>, B<-A>,
 and B<-C> filetests are based on this value.
 
+=item $^U
+
+Global flag that switches on Unicode character support in the Perl
+interpreter.  The initial value is usually C<0> for compatibility
+with Perl versions earlier than 5.6, but may be automatically set
+to C<1> by Perl if the system provides a user-settable default
+(e.g., C<$ENV{LC_CTYPE}>).  It is also implicitly set to C<1>
+whenever the utf8 pragma is loaded.
+
+Setting it to C<1> has the following effects:
+
+=over
+
+=item *
+
+C<chr> produces UTF-8 encoded Unicode characters.  These are the same
+as the corresponding ASCII characters if the argument is less than 128.
+
+=item *
+
+The C<%c> format in C<sprintf> generates a UTF-8 encoded Unicode
+character.  This is the same as the corresponding ASCII character
+if the argument is less than 128.
+
+=item *
+
+Any system calls made by Perl will use wide character APIs native to
+the system, if available.  This is currently only implemented on the
+Windows platform.
+
+=back
+
+The C<byte> pragma overrides the value of this flag in the current
+lexical scope.  See L<byte>.
+
+=item $^V
+
+The revision, version, and subversion of the Perl interpreter, represented
+as a "version tuple".  Version tuples have both a numeric value and a
+string value.  The numeric value is a floating point number that amounts
+to revision + version/1000 + subversion/1000000, and the string value
+is made of utf8 characters:
+C<chr($revision) . chr($version) . chr($subversion)>.
+
+This can be used to determine whether the Perl interpreter executing a
+script is in the right range of versions.  (Mnemonic: use ^V for Version
+control.)  Example:
+
+    warn "No "our" declarations!\n" if $^V and $^V lt v5.6;
+
+See also the documentation of C<use VERSION> and C<require VERSION>
+for a convenient way to fail if the running Perl interpreter is too old.
+
+See also C<$]> for an older representation of the Perl version.
+
 =item $WARNING
 
 =item $^W
 
 The current value of the warning switch, initially true if B<-w>
 was used, false otherwise, but directly modifiable.  (Mnemonic:
-related to the B<-w> switch.)  See also L<warning>.
+related to the B<-w> switch.)  See also L<warnings>.
+
+=item ${^Warnings}
+
+The current set of warning checks enabled by the C<use warnings> pragma.
+See the documentation of C<warnings> for more details.
 
 =item $EXECUTABLE_NAME
 
@@ -861,7 +984,7 @@ The hash %INC contains entries for each filename included via the
 C<do>, C<require>, or C<use> operators.  The key is the filename
 you specified (with module names converted to pathnames), and the
 value is the location of the file found.  The C<require>
-operator uses this array to determine whether a particular file has
+operator uses this hash to determine whether a particular file has
 already been included.
 
 =item %ENV
@@ -965,7 +1088,7 @@ Carp was available.  The third line will be executed only if Carp was
 not available.
 
 See L<perlfunc/die>, L<perlfunc/warn>, L<perlfunc/eval>, and
-L<warning> for additional information.
+L<warnings> for additional information.
 
 =back
 
@@ -1040,7 +1163,7 @@ C<W>) is the scalar variable whose name is the single character
 control-C<W>.  This is better than typing a literal control-C<W>
 into your program.
 
-Finally, new in Perl 5.006, Perl variable names may be alphanumeric
+Finally, new in Perl 5.6, Perl variable names may be alphanumeric
 strings that begin with control characters (or better yet, a caret).
 These variables must be written in the form C<${^Foo}>; the braces
 are not optional.  C<${^Foo}> denotes the scalar variable whose