########
# toke.c
our $foo :unique;
+sub pam :locked;
+sub glipp :locked {
+}
+sub whack_eth ($) : locked {
+}
use warnings 'deprecated';
our $bar :unique;
+sub zapeth :locked;
+sub ker_plop :locked {
+}
+sub swa_a_p ($) : locked {
+}
EXPECT
-Use of :unique is deprecated at - line 4.
+Use of :unique is deprecated at - line 9.
+Use of :locked is deprecated at - line 10.
+Use of :locked is deprecated at - line 11.
+Use of :locked is deprecated at - line 13.
########
# toke.c
use warnings "syntax";
require './test.pl';
}
-plan 90;
+plan 83;
$SIG{__WARN__} = sub { die @_ };
is( $@, '', @_);
}
-eval_ok 'sub t1 ($) : locked { $_[0]++ }';
-eval_ok 'sub t2 : locked { $_[0]++ }';
-eval_ok 'sub t3 ($) : locked ;';
-eval_ok 'sub t4 : locked ;';
-our $anon1; eval_ok '$anon1 = sub ($) : locked:method { $_[0]++ }';
-our $anon2; eval_ok '$anon2 = sub : locked : method { $_[0]++ }';
-our $anon3; eval_ok '$anon3 = sub : method { $_[0]->[1] }';
+our $anon1; eval_ok '$anon1 = sub : method { $_[0]++ }';
eval 'sub e1 ($) : plugh ;';
like $@, qr/^Invalid CODE attributes?: ["']?plugh["']? at/;
eval 'package Z; sub Y::bar : foo';
like $@, qr/^X at /;
-eval 'package Z; sub Y::baz : locked {}';
-my @attrs = eval 'attributes::get \&Y::baz';
-is "@attrs", "locked";
-
@attrs = eval 'attributes::get $anon1';
-is "@attrs", "locked method";
+is "@attrs", "method";
sub Z::DESTROY { }
sub Z::FETCH_CODE_ATTRIBUTES { return 'Z' }
-my $thunk = eval 'bless +sub : method locked { 1 }, "Z"';
+my $thunk = eval 'bless +sub : method { 1 }, "Z"';
is ref($thunk), "Z";
@attrs = eval 'attributes::get $thunk';
-is "@attrs", "locked method Z";
+is "@attrs", "method Z";
# Test attributes on predeclared subroutines:
eval 'package A; sub PS : lvalue';
}
else if (!PL_in_my && len == 6 && strnEQ(SvPVX(sv), "locked", len)) {
sv_free(sv);
- CvLOCKED_on(PL_compcv);
+ deprecate(":locked");
}
else if (!PL_in_my && len == 6 && strnEQ(SvPVX(sv), "method", len)) {
sv_free(sv);