Subject: | Compilation error when POSIX.pm fails to load |
Just a small observation...
When looking into a testing issue with CPAN::Reporter
(https://rt.cpan.org/Ticket/Display.html?id=74368)
I found that IPC::Cmd throws a compilation error (regarding bareword
WNOHANG)
in the (probably unlikely) event that POSIX fails to load.
However the real error (that POSIX failed to load) is hidden.
In IPC::Cmd there's a big eval block that loads a bunch of modules
and helps to determine the value of $CAN_USE_RUN_FORKED.
POSIX is included in this eval, but the bareword WNOHANG
is used in the source code and causes a compilation error.
POSIX probably isn't supposed to fail to load,
but I wondered if it might be more appropriate to load POSIX outside the
eval
(if you are actually depending on it)
or to use parens with WNOHANG() to avoid the compilation error.
C:\strawberry\cpan\build\CPAN-Reporter-1.2003-th3497>perl -Ilib -e
"local $^O=q[
unknown]; print eval q[require IPC::Cmd] || $@; print qq[\n\n] .
$IPC::Cmd::CAN_
USE_RUN_FORKED;"
Bareword "WNOHANG" not allowed while "strict subs" in use at
C:/strawberry/perl/
lib/IPC/Cmd.pm line 417.
BEGIN not safe after errors--compilation aborted at
C:/strawberry/perl/lib/IPC/C
md.pm line 1285.
Compilation failed in require at (eval 1) line 2.
Can't locate ./C:/strawberry/perl/lib/auto/POSIX/load_import.al in @INC
(@INC co
ntains: lib C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib
C:/strawbe
rry/perl/lib .) at C:/strawberry/perl/lib/POSIX.pm line 25
This is using the 5.14.2 strawberry perl preview release on Win XP Home SP3.