sub : attrlist
[p5sagit/p5-mst-13.2.git] / pod / perldelta.pod
index 0cb375a..353c62d 100644 (file)
@@ -193,7 +193,7 @@ extension (not included with the standard Perl distribution) may also
 be of use.
  
 (Large file support is also related to 64-bit support, for obvious reasons)
+
 =head2 Better syntax checks on parenthesized unary operators
 
 Expressions such as:
@@ -269,9 +269,25 @@ As before, lexical variables may not have names beginning with control
 characters.  As before, variables whose names begin with a control
 character are always forced to be in package `main'.  All such variables
 are reserved for future extensions, except those that begin with
-C<^_>, which may be used by user programs and is guaranteed not to
+C<^_>, which may be used by user programs and are guaranteed not to
 acquire special meaning in any future version of Perl.
 
+=head2 C<use attrs> implicit in subroutine attributes
+
+Formerly, if you wanted to mark a subroutine as being a method call or
+as requiring an automatic lock() when it is entered, you had to declare
+that with a C<use attrs> pragma in the body of the subroutine.
+That can now be accomplished with a declaration syntax, like this:
+
+    sub mymethod : locked, method ;
+    ...
+    sub mymethod : locked, method {
+       ...
+    }
+
+F<AutoSplit.pm> and F<SelfLoader.pm> have been updated to keep the attributes
+with the stubs they provide.  See L<attributes>.
+
 =head1 Significant bug fixes
 
 =head2 E<lt>HANDLEE<gt> on empty files
@@ -364,26 +380,34 @@ EPOC is is now supported (on Psion 5).
 
 =over 4
 
-=item  op/io_const
+=item  lib/attrs
+
+Compatibility tests for C<sub : attrs> vs the older C<use attrs>.
+
+=item  lib/io_const
 
 IO constants (SEEK_*, _IO*).
 
-=item  op/io_dir
+=item  lib/io_dir
 
 Directory-related IO methods (new, read, close, rewind, tied delete).
 
-=item  op/io_multihomed
+=item  lib/io_multihomed
 
 INET sockets with multi-homed hosts.
 
-=item  op/io_poll
+=item  lib/io_poll
 
 IO poll().
 
-=item  op/io_unix
+=item  lib/io_unix
 
 UNIX sockets.
 
+=item  op/attrs
+
+Regression tests for C<my ($x,@y,%z) : attrs> and <sub : attrs>.
+
 =item  op/filetest
 
 File test operators.
@@ -400,6 +424,12 @@ Verify operations that access pad objects (lexicals and temporaries).
 
 =over 4
 
+=item attributes
+
+While used internally by Perl as a pragma, this module also
+provides a way to fetch subroutine and variable attributes.
+See L<attributes>.
+
 =item ByteLoader
 
 The ByteLoader is a dedication extension to generate and run
@@ -540,6 +570,10 @@ See L<perldbmfilter> for further information.
 
 =head2 Pragmata
 
+C<use attrs> is now obsolescent, and is only provided for
+backward-compatibility.  It's been replaced by the C<sub : attributes>
+syntax.  See L<perlsub/"Subroutine Attributes"> and L<attributes>.
+
 C<use utf8> to enable UTF-8 and Unicode support.
 
 C<use caller 'encoding'> allows modules to inherit pragmatic attributes
@@ -579,6 +613,18 @@ A tutorial on managing class data for object modules.
 
 =head1 New Diagnostics
 
+=item "my sub" not yet implemented
+
+(F) Lexically scoped subroutines are not yet implemented.  Don't try that
+yet.
+
+=item %s package attribute may clash with future reserved word: %s
+
+(W) A lowercase attribute name was used that had a package-specific handler.
+That name might have a meaning to Perl itself some day, even though it
+doesn't yet.  Perhaps you should use a mixed-case attribute name, instead.
+See L<attributes>.
+
 =item /%s/: Unrecognized escape \\%c passed through
 
 (W) You used a backslash-character combination which is not recognized
@@ -593,16 +639,52 @@ intended it to be a read-write filehandle, you needed to open it with
 you intended only to read from the file, use "E<lt>".  See
 L<perlfunc/open>.
 
+=item Invalid %s attribute: %s
+
+The indicated attribute for a subroutine or variable was not recognized
+by Perl or by a user-supplied handler.  See L<attributes>.
+
+=item Invalid %s attributes: %s
+
+The indicated attributes for a subroutine or variable were not recognized
+by Perl or by a user-supplied handler.  See L<attributes>.
+
+=item Invalid separator character %s in attribute list
+
+(F) Something other than a comma or whitespace was seen between the
+elements of an attribute list.  If the previous attribute
+had a parenthesised parameter list, perhaps that list was terminated
+too soon.  See L<attributes>.
+
 =item Missing command in piped open
 
 (W) You used the C<open(FH, "| command")> or C<open(FH, "command |")>
 construction, but the command was missing or blank.
 
+=item Missing name in "my sub"
+
+(F) The reserved syntax for lexically scoped subroutines requires that they
+have a name with which they can be found.
+
 =item Unrecognized escape \\%c passed through
 
 (W) You used a backslash-character combination which is not recognized
 by Perl.
 
+=item Unterminated attribute parameter in attribute list
+
+(F) The lexer saw an opening (left) parenthesis character while parsing an
+attribute list, but the matching closing (right) parenthesis
+character was not found.  You may need to add (or remove) a backslash
+character to get your parentheses to balance.  See L<attributes>.
+
+=item Unterminated attribute list
+
+(F) The lexer found something other than a simple identifier at the start
+of an attribute, and it wasn't a semicolon or the start of a
+block.  Perhaps you terminated the parameter list of the previous attribute
+too soon.  See L<attributes>.
+
 =item defined(@array) is deprecated
 
 (D) defined() is not usually useful on arrays because it checks for an
@@ -615,6 +697,27 @@ just use C<if (@array) { # not empty }> for example.
 undefined I<scalar> value.  If you want to see if the hash is empty,
 just use C<if (%hash) { # not empty }> for example.  
 
+=item Invalid separator character %s in subroutine attribute list
+
+(F) Something other than a comma or whitespace was seen between the
+elements of a subroutine attribute list.  If the previous attribute
+had a parenthesised parameter list, perhaps that list was terminated
+too soon.
+
+=item Unterminated attribute parameter in subroutine attribute list
+
+(F) The lexer saw an opening (left) parenthesis character while parsing a
+subroutine attribute list, but the matching closing (right) parenthesis
+character was not found.  You may need to add (or remove) a backslash
+character to get your parentheses to balance.
+
+=item Unterminated subroutine attribute list
+
+(F) The lexer found something other than a simple identifier at the start
+of a subroutine attribute, and it wasn't a semicolon or the start of a
+block.  Perhaps you terminated the parameter list of the previous attribute
+too soon.
+
 =head1 Obsolete Diagnostics
 
 Todo.