in reply to How can I include a module for Windows only??

The problem with your original code is probably that the require Expect is failing so it never gets to the require Win32::Setupsup. For an easy fix, put the two in separate evals.

Or you can say:

use if $^O=~/Win/, "Win32::Setupsup"; use if $^O!~/Win/, "Expect";
IIRC, if.pm is in every perl version > 5.6.1 except 5.8.0, and is also available from cpan.

Update: I noticed a couple of posts saying /^Win/, which is wrong:

$ fgrep osname= hints/*.sh */config* hints/epix.sh:osname='epix2' hints/linux.sh:# The DR2 of MkLinux (osname=linux,archname=ppc-linux) +may need hints/mpeix.sh:osname='mpeix' hints/os400.sh: osname=aix hints/qnx.sh: *) osname='nto' Cross/config.sh-arm-linux:osname='linux' NetWare/config.wc:osname='NetWare' Porting/config.sh:osname='dec_osf' epoc/config.sh:osname='epoc' plan9/config_sh.sample:osname='plan9' win32/config.bc:osname='MSWin32' win32/config.gc:osname='MSWin32' win32/config.vc:osname='MSWin32' win32/config.vc64:osname='MSWin32' wince/config.ce:osname='MSWin32'
It is MSWin32 (even on 64-bit windows, I think).