# Source: https://rt.cpan.org/Public/Ticket/Attachment/1507017/803268/B-Lint-1.20-Skip-a-bare-sub-test.patch diff --git a/lib/B/Lint.pm b/lib/B/Lint.pm index 1f5098f..7291b18 100644 --- a/lib/B/Lint.pm +++ b/lib/B/Lint.pm @@ -85,6 +85,10 @@ trap are: Neither of these will do what a naive user would expect. +Notice: Perl 5.22.0 does not report C in C<$b{foo}> as BARE token +anymore. Therefore L test is not reliable here. See +L. + =item B This option warns whenever C<$_> is used either explicitly anywhere or diff --git a/t/lint.t b/t/lint.t index 7317b1d..93255d9 100644 --- a/t/lint.t +++ b/t/lint.t @@ -14,7 +14,7 @@ BEGIN { use strict; use warnings; -plan tests => 29; +plan tests => 30; # Runs a separate perl interpreter with the appropriate lint options # turned on @@ -116,10 +116,17 @@ RESULT runlint 'bare-subs', 'sub bare(){1};$x=bare', ''; -runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]; $x=$y{bare}', <<'RESULT'; +runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]', <<'RESULT'; Bare sub name 'bare' interpreted as string at -e line 1 +RESULT + +SKIP: { + skip 'Perl 5.22 stopped marking $hash{bare} as BARE word, CPAN RT#101115', + 1, if $] >= 5.022; + runlint 'bare-subs', 'sub bare(){1}; $x=$y{bare}', <<'RESULT'; Bare sub name 'bare' interpreted as string at -e line 1 RESULT +} { --