our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $Verbose, $Keep, $Maxlen,
$CheckForAutoloader, $CheckModTime);
-$VERSION = "1.0304";
+$VERSION = "1.0305";
@ISA = qw(Exporter);
@EXPORT = qw(&autosplit &autosplit_lib_modules);
@EXPORT_OK = qw($Verbose $Keep $Maxlen $CheckForAutoloader $CheckModTime);
# allow checking for valid ': attrlist' attachments
my $nested;
$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x;
-my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) [\s,]* }x;
+my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
sub testtesttesttest4_1 ($) { "another test 4\n"; }
sub testtesttesttest4_2 ($$) { "another duplicate test 4\n"; }
package Yet::More::Attributes;
-sub test_a1 ($) : locked { 1; }
+sub test_a1 ($) : locked :locked { 1; }
sub test_a2 : locked { 1; }
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(AUTOLOAD);
-$VERSION = "1.09";
+$VERSION = "1.0901";
sub Version {$VERSION}
$DEBUG = 0;
# allow checking for valid ': attrlist' attachments
my $nested;
$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x;
-my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) [\s,]* }x;
+my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
sub croak { require Carp; goto &Carp::croak }
package attributes;
-$VERSION = 0.02;
+$VERSION = 0.03;
@EXPORT_OK = qw(get reftype);
@EXPORT = ();
my $s = ((@pkgattrs == 1) ? '' : 's');
carp "$svtype package attribute$s " .
"may clash with future reserved word$s: " .
- join(' , ' , @pkgattrs);
+ join(' : ' , @pkgattrs);
}
}
}
croak "Invalid $svtype attribute" .
(( @badattrs == 1 ) ? '' : 's') .
": " .
- join(' , ', @badattrs);
+ join(' : ', @badattrs);
}
}
=head2 Syntax of Attribute Lists
An attribute list is a sequence of attribute specifications, separated by
-whitespace, commas, or both. Each attribute specification is a simple
+whitespace or a colon (with optional whitespace).
+Each attribute specification is a simple
name, optionally followed by a parenthesised parameter list.
If such a parameter list is present, it is scanned past as for the rules
for the C<q()> operator. (See L<perlop/"Quote and Quote-like Operators">.)
Some examples of syntactically valid attribute lists:
- switch(10,foo(7,3)) , , expensive
- Ugly('\(") , Bad
+ switch(10,foo(7,3)) : expensive
+ Ugly('\(") :Bad
_5x5
locked method
Ugly('(') # ()-string not balanced
5x5 # "5x5" not a valid identifier
Y2::north # "Y2::north" not a simple identifier
- foo + bar # "+" neither a comma nor whitespace
+ foo + bar # "+" neither a colon nor whitespace
=head1 EXPORTS
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 ;
...
- sub mymethod : locked, method {
+ sub mymethod : locked :method {
...
}
=item Invalid separator character %s in attribute list
-(F) Something other than a comma or whitespace was seen between the
+(F) Something other than a colon 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 Invalid separator character %s in subroutine attribute list
-(F) Something other than a comma or whitespace was seen between the
+(F) Something other than a colon 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 Invalid separator character %s in attribute list
-(F) Something other than a comma or whitespace was seen between the
+(F) Something other than a colon 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>.
A subroutine declaration or definition may have a list of attributes
associated with it. If such an attribute list is present, it is
-broken up at space or comma boundaries and treated as though a
+broken up at space or colon boundaries and treated as though a
C<use attributes> had been seen. See L<attributes> for details
about what attributes are currently supported.
Unlike the limitation with the obsolescent C<use attrs>, the
Examples of valid syntax (even though the attributes are unknown):
- sub fnord (&\%) : switch(10,foo(7,3)) , , expensive ;
- sub plugh () : Ugly('\(") , Bad ;
+ sub fnord (&\%) : switch(10,foo(7,3)) : expensive ;
+ sub plugh () : Ugly('\(") :Bad ;
sub xyzzy : _5x5 { ... }
Examples of invalid syntax:
sub snoid : Ugly('(') ; # ()-string not balanced
sub xyzzy : 5x5 ; # "5x5" not a valid identifier
sub plugh : Y2::north ; # "Y2::north" not a simple identifier
- sub snurt : foo + bar ; # "+" not a comma or space
+ sub snurt : foo + bar ; # "+" not a colon or space
The attribute list is passed as a list of constant strings to the code
which associates them with the subroutine. In particular, the second example
BEGIN {++$ntests}
my $anon1;
-eval '$anon1 = sub ($) : locked,,method { $_[0]++ }';
+eval '$anon1 = sub ($) : locked:method { $_[0]++ }';
mytest;
BEGIN {++$ntests}
my $anon2;
-eval '$anon2 = sub : locked , method { $_[0]++ }';
+eval '$anon2 = sub : locked : method { $_[0]++ }';
mytest;
BEGIN {++$ntests}
newSVpvn(s, len)));
}
s = skipspace(d);
- while (*s == ',')
+ if (*s == ':' && s[1] != ':')
s = skipspace(s+1);
+ else if (s == d)
+ break; /* require real whitespace or :'s */
}
tmp = (PL_expect == XOPERATOR ? '=' : '{'); /*'}(' for vi */
if (*s != ';' && *s != tmp && (tmp != '=' || *s != ')')) {