mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
ParseXS: enable + fix warnings in CountLines.pm
This private helper module had 'strict' enabled, but not warnings.
So enable them, and fix up a problem it reveals:
the destructor for the tied handle was trying to write the buffer
contents even if the buffer was empty. This is harmless, but was now
triggering a warning for some tests which tested for an error condition
that didn't produce any output, e.g.:
../dist/ExtUtils-ParseXS/t/002-parse-file-scope.t ................... 1/?
print() on unopened filehandle FH at .../CountLines.pm line 44 during global destruction.
This is also a fix for running under 5.8.9, whose test harness rather
anti-socially invokes perl with -w. Which is how I got to know about the
warnings in the first place.
This commit is contained in:
parent
bd5fe844a4
commit
7a99bbb5b7
@ -1,5 +1,18 @@
|
||||
package ExtUtils::ParseXS::CountLines;
|
||||
|
||||
# Private helper module. It is used to tie a file handle, and
|
||||
# whenever lines are written to it, lines which match the
|
||||
#
|
||||
# ExtUtils::ParseXS::CountLines->end_marker()
|
||||
#
|
||||
# token are replaced with:
|
||||
#
|
||||
# #line NNN file.c
|
||||
#
|
||||
# where NNN is the count of lines written so far.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '3.62';
|
||||
|
||||
@ -40,7 +53,7 @@ sub PRINTF {
|
||||
sub DESTROY {
|
||||
# Not necessary if we're careful to end with a "\n"
|
||||
my $self = shift;
|
||||
print {$self->{fh}} $self->{buffer};
|
||||
print {$self->{fh}} $self->{buffer} if length $self->{buffer};
|
||||
}
|
||||
|
||||
sub UNTIE {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user