From 27587ca8b7ddef294972dc381e6b28b5c325e86b Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Tue, 4 May 2021 12:51:45 +0200 Subject: [PATCH] compat with perl 5.33.7+ Fix for https://github.com/lokku/Perl-Critic-Lokku/issues/7 --- lib/Perl/Critic/Policy/TryTiny/ProhibitExitingSubroutine.pm | 2 +- lib/Perl/Critic/Policy/TryTiny/RequireCatch.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Perl/Critic/Policy/TryTiny/ProhibitExitingSubroutine.pm b/lib/Perl/Critic/Policy/TryTiny/ProhibitExitingSubroutine.pm index a827564..ddffe90 100644 --- a/lib/Perl/Critic/Policy/TryTiny/ProhibitExitingSubroutine.pm +++ b/lib/Perl/Critic/Policy/TryTiny/ProhibitExitingSubroutine.pm @@ -48,7 +48,7 @@ sub violates { my ($self, $elem, undef) = @_; return if $elem->content ne 'try'; - return if ! is_function_call($elem); + return if ! is_function_call($elem) && !($] >= 5.033007 && is_perl_bareword($elem)); my @blocks_to_check; diff --git a/lib/Perl/Critic/Policy/TryTiny/RequireCatch.pm b/lib/Perl/Critic/Policy/TryTiny/RequireCatch.pm index fd65614..4af17b0 100644 --- a/lib/Perl/Critic/Policy/TryTiny/RequireCatch.pm +++ b/lib/Perl/Critic/Policy/TryTiny/RequireCatch.pm @@ -48,7 +48,7 @@ sub violates { my ($self, $elem, undef) = @_; return if $elem->content ne 'try'; - return if ! is_function_call($elem); + return if ! is_function_call($elem) && !($] >= 5.033007 && is_perl_bareword($elem)); my $try_block = $elem->snext_sibling() or return; my $sib = $try_block->snext_sibling(); -- 2.25.1