diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-09-15 16:29:21 -0700 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2013-10-05 14:20:09 -0400 |
commit | eae81d973bc62051b9fbdc6adab6609b87c5f670 (patch) | |
tree | 50d45fdae014330789d7f39432f0c7497c61a0b9 | |
parent | e92bffe7a4abdf9f39a3f336034eb8a96ac58411 (diff) | |
download | perl-eae81d973bc62051b9fbdc6adab6609b87c5f670.tar.gz |
Hide postderef behind the feature feature
-rw-r--r-- | t/op/postfixderef.t | 28 | ||||
-rw-r--r-- | toke.c | 6 |
2 files changed, 31 insertions, 3 deletions
diff --git a/t/op/postfixderef.t b/t/op/postfixderef.t index 6569db36d5..080b477b5a 100644 --- a/t/op/postfixderef.t +++ b/t/op/postfixderef.t @@ -16,7 +16,33 @@ BEGIN { use strict qw(refs subs); -plan(96); +plan(106); + +{ + no warnings qw 'deprecated syntax'; + eval '[]->$*'; + like $@, qr/Can't call method/, '->$* outside of feature scope'; + eval '[]->@*'; + like $@, qr/syntax error/, '->@* outside of feature scope'; + eval '[]->@[1]'; + like $@, qr/syntax error/, '->@[ outside of feature scope'; + eval '[]->@{1}'; + like $@, qr/syntax error/, '->@{ outside of feature scope'; + eval '[]->%*'; + like $@, qr/syntax error/, '->%* outside of feature scope'; + eval '[]->%[1]'; + like $@, qr/syntax error/, '->%[ outside of feature scope'; + eval '[]->%{1}'; + like $@, qr/syntax error/, '->%{ outside of feature scope'; + eval '[]->&*'; + like $@, qr/syntax error/, '->&* outside of feature scope'; + eval '[]->**'; + like $@, qr/syntax error/, '->** outside of feature scope'; + eval '[]->*{'; + like $@, qr/syntax error/, '->*{ outside of feature scope'; +} + +use feature 'postderef'; { no strict 'refs'; @@ -5758,9 +5758,11 @@ Perl_yylex(pTHX) else if (*s == '>') { s++; s = SKIPSPACE1(s); - if (((*s == '$' || *s == '&') && s[1] == '*') + if (FEATURE_POSTDEREF_IS_ENABLED && ( + ((*s == '$' || *s == '&') && s[1] == '*') ||((*s == '@' || *s == '%') && strchr("*[{", s[1])) - ||(*s == '*' && (s[1] == '*' || s[1] == '{'))) + ||(*s == '*' && (s[1] == '*' || s[1] == '{')) + )) { PL_expect = XPOSTDEREF; TOKEN(ARROW); |