in reply to porting a script to windows
Hi Monks, I need to port a perl script to windows.I want to know that is there some direct way to do it or I need to change all the unix commands which i have used in my script?
If you mean Perl builtins that have their roots in Unix culture, then you won't need to change anything. However, if you've been calling actual external system commands (e.g., with backticks, system, or exec), then that's inherently unportable. (It's often not even portable from one Unix to another, unless you know what you're doing. For instance, `ps -A` works on Linux, but on some unices you have to use `ps -x` instead. On Windows, of course, ps is not a command at all.)
Another thing to note is that if you have hardcoded any paths, you'll have to change them. However, you *should* be reading in paths from a configuration file or the command line (unless your code is all in a single file, in which case you can just set them in variables at the very top of the script). Hardcoding paths leads to trouble even if you don't end up porting to a completely different platform.
The biggest pain in moving to Win32 is that with the most popular Perl distribution (from ActiveState), there's no CPAN support out of the box. There's ppm, but it's just not the same. If you rely heavily on the CPAN, you may end up needing to go with Cygwin Perl or somesuch so that you can get CPAN.pm working.
Oh, and there's also the small matter of Perl not being included in the operating system. Windows is, as far as I am aware, the *only* major operating system remaining that *doesn't* include perl out of the box.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: porting a script to windows
by secret (Beadle) on Dec 13, 2005 at 14:30 UTC | |
by jonadab (Parson) on Dec 18, 2005 at 14:08 UTC |