Subject: | Events are always terminated with \n, regardless of the `noeol' option |
Date: | Wed, 10 Jun 2015 11:52:23 +0000 |
To: | "bug-Sys-Syslog [...] rt.cpan.org" <bug-Sys-Syslog [...] rt.cpan.org> |
From: | Markus Laker <Markus.Laker [...] hds.com> |
Hello,
In v0.33, the `noeol' option to &openlog is ignored, and every event is unconditionally terminated with a newline. The `noeol' option is correctly tested in this line from &syslog:
$buf .= "\n" if !$options{noeol} and rindex($buf, "\n") == -1;
But it's too late, because a newline has already been added by this line, earlier in the same sub:
$mask .= "\n" unless $mask =~ /\n$/;
The bug can be fixed by the addition of a simple check:
$mask .= "\n" unless $options{noeol} or $mask =~ /\n$/;
In fact, the $mask statement makes the $buf statement into an unnecessary duplicate. The $buf statement could, and therefore should, be removed.
It probably isn't relevant in this case, but I'm using Perl v5.20.2 on Debian Jessie.
Best regards, and many thanks for looking into this,
Markus