Reputation: 82
My perl script must run on windows as well as Linux server. As the script runs, I have to update the registry for specific things. When I use "use Win32::Registry" It works fine on windows but on Linux it gives errors regardless of the following if statement.
if ($OS =~ /Windows/ )
{
use Win32::Registry;
...
...
}
In my view, perl loads "use" at compilation time and that must be the problem. What can I do so that Perl does not load use win 32 command when running on Linux?
I tried using
if ($OS =~ /Windows/ )
{
require Win32::Registry;
...
...
}
with this, the script runs fine on both servers but it saves binary values in registry and not string value.
So how can I make the Perl script run on both servers and save string values in registry?
Thank you.
Upvotes: 1
Views: 293