sub log { my ($self, $text) = @_; if (my $fp = $self->{lfp}) { my $r = $fp->syswrite($text); die "$r=log($self->{logfile}): write failed: $text\n" if $r != length($text); $self->{lfp_printed}++; } }