dannyd has asked for the wisdom of the Perl Monks concerning the following question:
Good Evening experts,
I have a pretty simple question, but have not been able to find a solution, me being a newbie and all:(
I have a script that needs to be run on a windows machine and a Linux machine(without code changes).
I finished the part for windows, but I have the statement use Win32::EventLog; at the top of the code, and I get a compilation error when I run the script in Linux.
This is what I've tried to do to fix it,
#!/usr/bin/perl -w my $OsDep = 'File::Copy'; if ($^O =~ /MSWin/i) { $OsDep = "Win32\:\:EventLog"; } elsif ($^O =~ /Linux/i) { $OsDep = "File\:\:Copy"; } else { print "Please check documentation for Supported Operating Syst +ems.\n"; } use $OsDep;
Once again please help me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Common use statements for windows and Linux
by Corion (Patriarch) on Jan 18, 2011 at 12:53 UTC | |
|
Re: Common use statements for windows and Linux
by cdarke (Prior) on Jan 18, 2011 at 12:58 UTC | |
|
Re: Common use statements for windows and Linux
by tilly (Archbishop) on Jan 18, 2011 at 14:27 UTC |