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.


"In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68

Replies are listed 'Best First'.
Re^2: porting a script to windows
by secret (Beadle) on Dec 13, 2005 at 14:30 UTC

    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

    Uh ? What do you mean ? I have the standard activestate and when i type cpan (aliased to ppm) at the cmd prompt i have a cpan tool that allows me to install modules, with dependancies resolution and all :)

      ppm does not constitute CPAN support. It does provide for (some, limited) module installation, but what it provides is only comparable to what is available for other languages, like Java or Python; it is not full CPAN support. Many modules are not available at all, and those that are available are usually rather badly out of date.

      This is not entirely ActiveState's fault. They had to make bricks out of straw to provide anything at all for module installation, due to a marked paucity on the host operating system of the sorts of facilities that are normally expected on a POSIX system (e.g., make).