I've been building a perl 'application' for several months now, which has grown to require about 15 separate modules (and may require several more before I'm done). I mainly develop on Linux/BSD systems, not Windows. A good majority of the users of this application will likely be Windows users, based on our download statistics from the main project website that this application will become a part of. So far, so good... except I have a few questions about the 'linting' and 'delivery' approach:
  1. What considerations should I take to make sure that code that runs clean (with strict, warnings, diagnostics, -T) on POSIX systems will continue to run clean on Windows systems?
  2. Is there any change to @INC or the shebang between these systems I should worry about?
  3. When delivering the application itself, should I also bundle the required modules that it uses? Or should I add a snippet to the README that describes how to use PAR or PPM/CPAN to fetch and install these modules? I don't want to get bogged down in having to teach everyone how to use PPM or CPAN because they got some error or another with this, so I'd prefer it to be as clean as possible. This will also affect the POSIX (mostly Linux) users when installing these modules, which have quite a few requirements of their own, like XML::LibXML and others.
  4. What about using the modules as "local packages" under the application directory itself? (this code is not a module in itself, yet..)
  5. What rules change as far as error trapping/reporting, that can be abstracted into something portable between systems? i.e. how would cmd.exe (NT/XP) vs. command.com (98/ME) vs. /bin/sh differ in their interpolation in this regard?
  6. What about operations like open(), sysread(), and system()? Do they need specific "precautions" as well when run on Windows?

One of the thoughts I had was to write a quick script (batch/cmd file on Windows, shell script on POSIX, or maybe just a pure perl script itelf, which can detect the OS in place, and perform accordingly) which then can unpack the modules delivered with my application, push them into the right place, and so on, but that has its gotchas also.

I'm used to writing portable code across POSIX systems (Unix, BSD, Linux, Solaris, etc.) in C, but not with perl, and I know there are many more things to look out for.

Any insight from those who have done this? I'm specifically looking for options, alternatives, gotchas, and other means of accomplishing the task. Most of the modules are low-level XML, HTML, IO modules wrapped around some code that is doing a lot of text processing.


In reply to Delivering "portable" code between POSIX and Windows by hacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.