gokuraku has asked for the wisdom of the Perl Monks concerning the following question:
Sometimes I write scripts for Unix and Windows, since some tasks run the same on both, occasionally I have something simple that I want to run on both but have library dependencies that cause issues. Case in point now is I have a script that does some clean up by removing directories and on Windows does some registry removal. Ideally it would be nice to have the same script and use Win32::TieRegistry, but I have no found a good example or method of having use load a library depending on platform.
Using an if ($^O =~ /Win32/) { use Win32::TieRegistry } did not give me the right results, it seems to want to load this even before going through the if statement. I'm just curious if this is possible, if its been done or if I am barking up a tree with no cat inside.
Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Mulit-Platform use case
by cdarke (Prior) on Mar 19, 2009 at 14:42 UTC | |
Re: Mulit-Platform use case
by moritz (Cardinal) on Mar 19, 2009 at 14:34 UTC | |
Re: Mulit-Platform use case
by RyuMaou (Deacon) on Mar 19, 2009 at 19:30 UTC | |
by cdarke (Prior) on Mar 19, 2009 at 20:23 UTC |