make $@ local, so we don't print "Can't locate Undefined subroutine &Devel::Cover::get_coverage called" in other parts where we evaluate $@

This commit is contained in:
Johannes Schauer Marin Rodrigues 2022-01-07 14:41:22 +01:00
parent 79ae6f03fd
commit 1b0f7f1138
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -102,7 +102,13 @@ my @devfiles = (
# 3 -> debug output # 3 -> debug output
my $verbosity_level = 1; my $verbosity_level = 1;
my $is_covering = !!(eval { Devel::Cover::get_coverage() }); my $is_covering = 0;
{
# make $@ local, so we don't print "Undefined subroutine called"
# in other parts where we evaluate $@
local $@ = '';
$is_covering = !!(eval { Devel::Cover::get_coverage() });
}
# the reason why Perl::Critic warns about this is, that it suspects that the # the reason why Perl::Critic warns about this is, that it suspects that the
# programmer wants to implement a test whether the terminal is interactive or # programmer wants to implement a test whether the terminal is interactive or