Hey all,
On Windows (2012 server, running perl 5.22.1), I get expected results using use if ...;:
use if $^O !~ /MSWin/, "Proc::Daemon"; use if $^O =~ /MSWin/, "Win32::Daemon"; print "$INC{'Win32/Daemon.pm'}\n"; exit; __END__ C:/berrybrew/5.22.1_64/perl/vendor/lib/Win32/Daemon.pm
But on Ubuntu, running v5.22.1:
use if $^O !~ /MSWin/, 'Proc::Daemon'; use if $^O =~ /MSWin/, 'Win32::Daemon'; print "$INC{'Proc/Daemon.pm'}\n"; exit; __END__ Too few arguments to 'use if' (some code returning an empty list in li +st context?) at /home/ubuntu/perl5/perlbrew/perls/perl-5.22.1/lib/5.2 +2.1/if.pm line 7. BEGIN failed--compilation aborted at /home/ubuntu/perl5/perlbrew/perls +/perl-5.22.1/bin/bbtester line 6.
I can't really find anything about this being a known problem. Proc::Daemon is properly installed (as I can use it in a module without the conditional use):
perl -MProc::Daemon -E 'say $Proc::Daemon::VERSION' 0.23
Can anyone spot anything I'm doing wrong, or is this something that just doesn't work reliably?
Update: I just realized that this was my 1,000th post here on PerlMonks :)
In reply to Problem with ``use if COND, Some::Module'' on Linux by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |