in reply to Re^2: Can we do "use Win32:Service" on Unix ?"
in thread Can we do "use Win32:Service" on Unix ?"
Well ... not quite. The require will die ... so you need eval. Also, perl treats barewords special here - if you use a string, you'll need it to be 'Win32/Service.pm'. Stick to the barewords when possible ;-)
$runningOn = 'unix'; eval { require Win32::Service; $runningOn = 'windows'; };
Of course, we assume that Win32::Service never fails to load, but that's ok, since we make that assumption about most modules.
|
|---|