Basically, use is compile-time and will happen before you assign any variables, so use $OsDep will not work. I would rewrite the code to:
if (...) { require Win32::EventLog; Win32::EventLog->import(); } elsif (...) { require File::Copy; File::Copy->import(); } else { warn "Unknown OS $^O detected, using default module(s)."; require File::Copy; File::Copy->import(); };
In reply to Re: Common use statements for windows and Linux
by Corion
in thread Common use statements for windows and Linux
by dannyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |