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

Hello good monks,

I am faced with a problem that unless solved I am going to shoot someone/something/both. I can write perfectly good working scripts on my windows developement computer, but when change all that needs to be changed in order for it to work on my linux account, (paths, directories, path to perl, etc.) it dies. And for the weirdest reasons. Maybe it is something in my coding? Any time I do work out of my CGI book, it works with maybe a few fixable quirks I find this quite strange, and even more frustrating. If a kind monk could lend some kind advice, I would be ever so happy.

Ergo!!! Vis a Vis!!! Concordidly!!! Mr. Timberlake. I apologize. I don't usually like to use my big voice.
Will Ferrill as the Architect from the Matrix 2:Reloaded

Replies are listed 'Best First'.
Re: Making working cross-platform scripts?
by Zaxo (Archbishop) on Jul 03, 2003 at 02:32 UTC

    The main source of advice to read is perlport - Writing Portable Perl. The various platform pods, like perlwin32 and perlfreebsd, give more detail about what particular installations can do.

    You should produce a CPAN style build package to take care of platform differences on installation. Config.pm is invaluable for that, as well as sometimes at runtime.

    $^O, or $OSNAME in English.pm, is often useful, too.

    After Compline,
    Zaxo

Re: Making working cross-platform scripts?
by PodMaster (Abbot) on Jul 03, 2003 at 02:32 UTC
    Know your modules (make sure they're cross-platform), have them installed (where you intend to run yer program), and be very aware of `perldoc perlport' (only use stuff that is portable, and deal portably with stuff like paths ... basically the core File:: modules). Aside from that, best help you could get is to post a sample so we can make it portable.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Making working cross-platform scripts?
by naChoZ (Curate) on Jul 03, 2003 at 02:33 UTC
    Some code, some error messages, maybe some versions and such, you gotta give us something to work with.

    ~~
    naChoZ

      Here ya go:
      my code is on my pad, and here is the error message for this specific script:

      (2)No such file or directory: exec of /home/dhoss/public_html/cgi-bin/ +book/index.cgi failed 4279 [Wed Jul 2 22:36:47 2003] [error] [client 172.156.151.219] Pr +emature end of script headers: /home/dhoss/public_html/cgi-bin/book/i +ndex.cgi


      Ergo!!! Vis a Vis!!! Concordidly!!! Mr. Timberlake. I apologize. I don't usually like to use my big voice.
      Will Ferrill as the Architect from the Matrix 2:Reloaded
        I had a problem that was causing perl to throw error messages like that a while back when transfering perl scripts from winME to my freesco linux router. After pulling my hair out for a bit I realized that I was transfering them as text instead of binary. When I transfered them using binary (using ftp) everything worked fine.

        HTH
        Daeve

        To ask the obvious: Is the script executable? (did you e.g. chmod +x script.pl?). And is the path to perl in the first line correct?, the message 'no such file or directory' is issued if the shell can't find the executable it's told to feed the script to.

        regards,
        tomte


        Hlade's Law:

        If you have a difficult task, give it to a lazy person --
        they will find an easier way to do it.