Subject: | Failing test on Win32 when installing without Win32::EventLog |
Hi,
If you try to install Sys::Syslog (tested with 0.27) on a Win32 box
without Win32::EventLog you will get the following error during syslog.t:
# Failed test 'no warnings'
# at C:/STRAWB~1/perl/site/lib/Test/NoWarnings.pm line 45.
# There were 1 warning(s)
# Previous test 0 ''
# Warning: something's wrong at
C:\strawberry\cpan\build\Sys-Syslog-0.27-pigLok\blib\lib/Sys/Syslog.pm
line 124.
# at
C:\strawberry\cpan\build\Sys-Syslog-0.27-pigLok\blib\lib/Sys/Syslog.pm
line 124
# require Sys/Syslog.pm called at (eval 10) line 2
# main::BEGIN() called at
C:\strawberry\cpan\build\Sys-Syslog-0.27-pigLok\blib\lib/Sys/Syslog.pm
line 0
# eval {...} called at
C:\strawberry\cpan\build\Sys-Syslog-0.27-pigLok\blib\lib/Sys/Syslog.pm
line 0
# eval 'package main;
# use Sys::Syslog @{$args[0]};
# 1;
#
# ;' called at C:/STRAWB~1/perl/lib/Test/More.pm line 805
# Test::More::_eval('package main;\x{a}use Sys::Syslog
@{$args[0]};\x{a}1;\x{a}', 'ARRAY(0xaf993c)') called at
C:/STRAWB~1/perl/lib/Test/More.pm line 780
# Test::More::use_ok('Sys::Syslog', ':standard', ':extended',
':macros') called at t/syslog.t line 48
#
# Looks like you failed 1 test of 216.
t/syslog.t ...........
The problem is in this part of Syslog.pm:
...
my $is_Win32 = $^O =~ /Win32/i;
if (can_load("Sys::Syslog::Win32")) {
unshift @connectMethods, 'eventlog';
}
elsif ($is_Win32) {
warn $@;
}
...
It is not a good idea to do "warn $@;" (in case we have not
Win32::EventLog) and at the same time to have a "no warning" test in
syslog.t - it is obvious that it has to fail.
The possible fixes:
1) remove 'warn $@;'
2) replace 'warn $@;' with 'print STDERR "WARNING: Win32::EventLog not
present, Sys::Syslog functionality will be limited\n";'
3) skip no warning test in syslog.t if on Win32 and without Win32::EventLog
4) require Win32::EventLog as a prerequisite on Win32 system
The issue is quite annoying if Sys::Syslog is somewhere in dependency
chain of another module that wont install smoothly due to this bug.
Thanks for any feedback to this RT.
--
kmx