From: Jarkko Hietaniemi Date: Wed, 12 Jun 2002 22:36:15 +0000 (+0000) Subject: Document the my/our TYPE and ATTRIBUTES (Use the Camel Mk 3, Luke). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=307ea6df8c2001c2fa231e383f56d2397009a9e8;p=p5sagit%2Fp5-mst-13.2.git Document the my/our TYPE and ATTRIBUTES (Use the Camel Mk 3, Luke). p4raw-id: //depot/perl@17208 --- diff --git a/lib/attributes.pm b/lib/attributes.pm index 40b35b8..8b18b066 100644 --- a/lib/attributes.pm +++ b/lib/attributes.pm @@ -191,10 +191,7 @@ as a scalar variable, as described in L. =back -There are no built-in attributes for anything other than subroutines. - -=for hackers -What about C? +For global variables there is C attribute: see L. =head2 Available Subroutines diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 46b2be4..d6dcf49 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2626,12 +2626,22 @@ and C documentation. =item my EXPR +=item my TYPE EXPR + =item my EXPR : ATTRIBUTES +=item my TYPE EXPR : ATTRIBUTES + A C declares the listed variables to be local (lexically) to the enclosing block, file, or C. If -more than one value is listed, the list must be placed in parentheses. See -L for details. +more than one value is listed, the list must be placed in parentheses. + +The use of TYPE and ATTRIBUTES is considered experimental and subject +to change. TYPE is currently bound to the use of C pragma, +and attributes are handled using the C pragma, or starting +from Perl 5.8.0 also via the C module. See +L for details, and L, +L, and L. =item next LABEL @@ -3058,8 +3068,12 @@ See L and L for more about Unicode. =item our EXPR +=item our EXPR TYPE + =item our EXPR : ATTRIBUTES +=item our TYPE EXPR : ATTRIBUTES + An C declares the listed variables to be valid globals within the enclosing block, file, or C. That is, it has the same scoping rules as a "my" declaration, but does not create a local @@ -3099,15 +3113,20 @@ package, Perl will emit warnings if you have asked for them. our $bar; # emits warning An C declaration may also have a list of attributes associated -with it. B: This is an experimental feature that may be -changed or removed in future releases of Perl. It should not be -relied upon. - -The only currently recognized attribute is C which indicates -that a single copy of the global is to be used by all interpreters -should the program happen to be running in a multi-interpreter -environment. (The default behaviour would be for each interpreter -to have its own copy of the global.) Examples: +with it. + +The use of TYPE and ATTRIBUTES is considered experimental and subject +to change. TYPE is currently bound to the use of C pragma, +and attributes are handled using the C pragma, or starting +from Perl 5.8.0 also via the C module. See +L for details, and L, +L, and L. + +The only currently recognized C attribute is C which +indicates that a single copy of the global is to be used by all +interpreters should the program happen to be running in a +multi-interpreter environment. (The default behaviour would be for +each interpreter to have its own copy of the global.) Examples: our @EXPORT : unique = qw(foo); our %EXPORT_TAGS : unique = (bar => [qw(aa bb cc)]);