in reply to How can I include a module for Windows only??
Or you can say:
IIRC, if.pm is in every perl version > 5.6.1 except 5.8.0, and is also available from cpan.use if $^O=~/Win/, "Win32::Setupsup"; use if $^O!~/Win/, "Expect";
Update: I noticed a couple of posts saying /^Win/, which is wrong:
It is MSWin32 (even on 64-bit windows, I think).$ 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'
|
|---|