X-Git-Url: https://git.donarmstrong.com/perltidy.git?a=blobdiff_plain;f=lib%2FPerl%2FTidy%2FLogger.pm;h=f1c43860d03895d12a6b8fea231772028acbfebd;hb=8360fafa7774a02a63bd43854a82f22c335851d9;hp=194ca81c7e3a4f824f1451b0096fad44b107fc40;hpb=c514d57dc8088e1f4d3f51857b1155c20085c296;p=perltidy.git diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 194ca81..f1c4386 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -7,9 +7,10 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20220613'; +our $VERSION = '20221112'; use English qw( -no_match_vars ); +use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; @@ -458,7 +459,7 @@ sub get_save_logfile { sub finish { # called after all formatting to summarize errors - my ( $self, $formatter ) = @_; + my ($self) = @_; my $rOpts = $self->{_rOpts}; my $warning_count = $self->{_warning_count}; @@ -496,11 +497,13 @@ sub finish { my $routput_array = $self->{_output_array}; foreach my $line ( @{$routput_array} ) { $fh->print($line) } if ( $log_file ne '-' && !ref $log_file ) { - eval { $fh->close() }; + my $ok = eval { $fh->close(); 1 }; + if ( !$ok && DEVEL_MODE ) { + Fault("Could not close file handle(): $EVAL_ERROR\n"); + } } } } return; } 1; -