Hi, I have to write a script to do FTP file transfers that must run on Windows and Unix. For Windows, I will be using the Win32::Internet module and for Unix, I will be using the Net::FTP module. I have thought of several areas in which I might run into problems due to trying to get something to work transparently on both architectures and would appreciate any input into these situations as well as any I haven't thought of.

Creating an "FTPSession" Object for the Right Architecture at Runtime

This was discussed in a previous thread: Calling a class constructor as a function on input arguments

Trying to Include Modules Which Don't Exist for An Architecture

I think I have this one handled. I simply check $^O and do a run-time require as opposed to a compile-time use and thus only the modules existing for a particular architecture will be loaded on that architecture.

Code Will Have References to Variables and Functions (keywords) of the Modules for the Other OS

As I typed, I realized that one way to handle this is to move each arch's code into a different module and require the arch-dependent modules just as I do Win32::Internet and Net::FTP.

That being said, would there be compile-time errors if I used a single monolithic code body and made references to keywords of an unloaded module even if the code is never executed at runtime?


In reply to Managing Architecture-Dependant Perl Modules in an Object-Oriented Hierarchy by princepawn

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.