Author: larry Date: Fri Jun 8 11:09:37 2007 New Revision: 14416 Modified: doc/trunk/design/syn/S02.pod
Log: Added PROCESS as a superglobal namespace for easier apachefication of scripts. Modified: doc/trunk/design/syn/S02.pod ============================================================================== --- doc/trunk/design/syn/S02.pod (original) +++ doc/trunk/design/syn/S02.pod Fri Jun 8 11:09:37 2007 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 10 Aug 2004 - Last Modified: 2 Jun 2007 + Last Modified: 8 Jun 2007 Number: 2 - Version: 109 + Version: 110 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -1460,6 +1460,7 @@ MY # Lexical variables declared in the current scope OUR # Package variables declared in the current package GLOBAL # Builtin variables and functions + PROCESS # process-related globals OUTER # Lexical variables declared in the outer scope CALLER # Contextual variables in the immediate caller's scope CONTEXT # Contextual variables in any context's scope @@ -1674,6 +1675,28 @@ =item * +For an ordinary Perl program running by itself, the C<GLOBAL> and +C<PROCESS> namespaces are considered synonymous. However, it certain +situations (such as shared hosting under a webserver), the actually +process may contain multiple virtual processes, each running its own +"main" code. In this case, the C<GLOBAL> namespace holds variables +that properly belong to the individual virtual process, while the +C<PROCESS> namespace holds variables that properly belong to the actual +process as a whole. From the viewpoint of the C<GLOBAL> namespace +there is little difference, since process variables that normally +appear in C<GLOBAL> are automatically imported from C<PROCESS>. +However, the process as a whole may place restrictions on the +mutability of process variables as seen by the individual subprocesses. +Also, individual subprocesses may not create new process variables. +If the process wishes to grant subprocesses the ability to communicate +via the C<process> namespace, it must supply a writeable hash or some +such to all the subprocesses granted that privilege. + +When these namespaces are distinguished, the C<*> shortcut always refers +to C<GLOBAL>. There is no twigil shortcut for C<PROCESS::>. + +=item * + Standard input is C<$*IN>, standard output is C<$*OUT>, and standard error is C<$*ERR>. The magic command-line input handle is C<$*ARGS>. The arguments themselves come in C<@*ARGS>. See also "Declaring a MAIN