Skip to content

Commit a607fc1

Browse files
committed
Latest Sys::Syslog loading code from VWF
1 parent 8e14a61 commit a607fc1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dynamic-site/cgi-bin/page.fcgi

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,12 @@ sub vwflog
896896
close $fout;
897897
}
898898

899-
my $warnings = join('; ',
900-
grep defined, map { (($_->{'level'} eq 'warn') || ($_->{'level'} eq 'notice')) ? $_->{'message'} : undef } @{$info->messages()}
901-
);
899+
my $warnings;
900+
if(my $messages = $info->messages()) {
901+
$warnings = join('; ',
902+
grep defined, map { (($_->{'level'} eq 'warn') || ($_->{'level'} eq 'notice')) ? $_->{'message'} : undef } @{$messages}
903+
)
904+
}
902905
$warnings ||= '';
903906

904907
if(open(my $fout, '>>', $vwflog)) {
@@ -920,7 +923,10 @@ sub vwflog
920923
}
921924

922925
if($syslog) {
923-
require 'Sys::Syslog' && Sys::Syslog->import() unless Sys::Syslog->can('openlog');
926+
unless(Sys::Syslog->can('openlog')) {
927+
require Sys::Syslog;
928+
Sys::Syslog->import();
929+
}
924930

925931
if(ref($syslog) eq 'HASH') {
926932
Sys::Syslog::setlogsock($syslog);

0 commit comments

Comments
 (0)