See use:
It is exactly equivalent to BEGIN { require Module; import Module LIST; }
So, do just that, except possibly without the BEGIN block, if you want to delay the decision further:
# use Win32::OLE; # becomes if ($^O eq 'MSWin32') { # dunno about Cygwin require Win32::OLE; Win32::OLE->Option( Warn => 3 ); # to get quicker/better feedback +on errors };
In reply to Re: conditionally include a module
by Corion
in thread conditionally include a module
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |