From: Steve Hancock Date: Mon, 21 Sep 2020 01:56:31 +0000 (-0700) Subject: switch from eval { } to ->can('finish_formatting') X-Git-Tag: 20201001~23 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=28f2af498badfb8f54f64eac66abf4c22513298a;p=perltidy.git switch from eval { } to ->can('finish_formatting') --- diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 560da15c..7673b0b4 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -4307,7 +4307,11 @@ sub process_this_file { $formatter->write_line($line); } my $severe_error = $tokenizer->report_tokenization_errors(); - eval { $formatter->finish_formatting($severe_error) }; + + # user-defined formatters are possible, and may not have a + # sub 'finish_formatting', so we have to check + $formatter->finish_formatting($severe_error) + if $formatter->can('finish_formatting'); return; }