coreolyn has asked for the wisdom of the Perl Monks concerning the following question:

I'ved been tasked with getting a family of ksh and Perl scripts converted to a singe perl script with supporting modules that will work on both NT and Unix.

Oh wise ones hath you any wisdom to simplify the issues with the demonic file delimiter and other OS issues that most surely will haunt me on this task?

coreolyn

Replies are listed 'Best First'.
Re: Stupid OS portablity tricks wanted
by jryan (Vicar) on Jan 31, 2002 at 18:24 UTC
Re: Stupid OS portablity tricks wanted
by ViceRaid (Chaplain) on Jan 31, 2002 at 18:07 UTC

    One hassle is giving the names of files that you wish to open/read/write/destroy/whatever ... For simple, lazy compatability between *nix and Windows platforms, use the forward slash as it's recognised as a path separator on both. For more robust cross platform portability of filenames (including things like MacOS and VMS), take a look at the CPAN File::Spec module.

    /=\
Re: Stupid OS portablity tricks wanted
by Rex(Wrecks) (Curate) on Jan 31, 2002 at 18:16 UTC
    This really depends on what you are doing. The ^M delimiter should only show up in other utilities, and even if you get them in Perl they are fairly straight forward to strip.

    basically you really want to make sure that all of the modules you want to use are able to work on both OS's, I have found that many of the things (even most) work as good in Windows as in Unix.

    The other thing I would recomend, get the OS type right off the bat in all your scripts, this gives you the ability to split off into different paths later in the script if you need to use system or exec. However since you did not give a clue as to what your scripts are doing this may or may not be relevant.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
Re: Stupid OS portablity tricks wanted
by coreolyn (Parson) on Jan 31, 2002 at 19:01 UTC
    It looks like perlport has the bulk of the info I was looking for. Sorry I didn't go into more detail but I'm just beginning to scope the task.

    Essentially these scripts are used to manage the build and deploy of diverse Java applications by taking variables from unique ksh source files, executing the appropriate ANT script commands for the build of the ear file, and then feeding deployment instructions to another family of TCL scripts that deploy the new ear into Websphere.

    The end product should Duct Tape ANT to WebSphere for both NT and Unix with one set of scripts so as to avoid dual maintenance of the final product.

    coreolyn
Re: Stupid OS portablity tricks wanted
by rbc (Curate) on Feb 01, 2002 at 00:12 UTC
    Can you get away with installing Cygwin?
    If so try that.

      We considered cygwin but as we want these build scripts on the developers desktops as well as production, the overhead associated with supporting Cygwin on a several hundred desktops and the time delay of getting Cygwin approved for the production floor seemed prohibitive.

      ( And this has to be done by next Friday :)

      coreolyn