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

This is probably a foolish question, but I cannot find a good node about it

I have a script that I need a customer to run regularly on two systems. One is running some flavour of windows, the other is OS/2. They are having difficulty (political, not technical) with installing Perl environments on these systems.

Is there a way to package my script so that they can put a self contained item on each system and run it with no support software, other than the OS?

Thank you, O wise ones.

Skip

Replies are listed 'Best First'.
Re: Perl Scripts on systems without perl environments.
by renodino (Curate) on Nov 07, 2005 at 16:16 UTC

      Yeah, OS/2 is the trickiest, also the most essencial. They might be able to have perl on the Windows systems (but would rather not) OS/2 is very difficult for them.

      Skip

        Off-the-wall idea: you might want to contact the authors of Prima, which was originally written to provide a Perl GUI on OS/2 (which didn't support Tk). They might have some helpful OS/2 insights.

        -xdg

        Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Perl Scripts on systems without perl environments.
by Perl Mouse (Chaplain) on Nov 07, 2005 at 16:49 UTC
    Define "self-contained item". You mean, a single binary? A single package? A directory tree?

    Software packages to be self-contained, including vehicles to run their language are rather common. Over the decades, I've installed packages that carry their own Java, Python, whatever environment, and I've delivered software that included a complete Perl environment as well. Delivering Perl with your product solves so many problems - no mysterious problems you can't replicate in the office because your customer uses the version of Perl you support, but he got the CDs of his vendor in week X, and that's when build ZZZZ was on the CD and that version happens to contain a bug - one not present inbuild ZZZZ-1 and fixed in build ZZZZ+1.

    I prefer software packages to be self-sufficient as much as possible. I don't want to have to upgrade my javascript environment when I upgrade my browser (with the effect my other browser no longer works) - no, when I upgrade my browser, I expect it to come with javascript. And ideally, with Perl and Java and Rexx and Python, and whatever else it needs. I don't mind the discspace. 400 Gb drives are common, a few extra Perl installations on a box isn't going to hurt.

    Perl --((8:>*

      The customer would not accept that. Far too large. I have a reletively simple script, ~150 lines. that they need to run regularly. If I could install that (or a compiled version) and maybe a library or five, I should be OK. More than that and they will not be happy.

      Skip
        Why is installing five libraries ok, but a custom installation of Perl isn't? Perl is nothing more than a binary, and a bunch of libraries - most of them you won't need. In fact, you could create a Perl that statically links in every extension it needs (and don't compile what you don't need). And if you really must, you can get away with delivering just that binary - any (Perl) library code, you just copy-and-paste in your script. Or rather, use a makefile to spit out a single Perl script. Then you need just two files.

        OTOH, if all you have is a relative simple script, you could have written it in C in less time than it took for the participants of this thread to write their replies.

        Perl --((8:>*

      400GB drives may be common, by try getting a bank to install one on a seven year old system.

      Skip
        That's not your problem is it? All you say is "this package needs X Mb of installation space".
        Perl --((8:>*
Re: Perl Scripts on systems without perl environments.
by svenXY (Deacon) on Nov 07, 2005 at 16:16 UTC
    Hi,
    use PAR
    Regards,
    svenXY
Re: Perl Scripts on systems without perl environments.
by dragonchild (Archbishop) on Nov 07, 2005 at 17:10 UTC
    Rewrite the script in another language that would be available on those systems. That would be my first suggestion. You can inflate the price seeing as you wrote the script expecting one set of circumstances that is now politically infeasible, hence you have to start over.

    An alternative would be write a main() in C that embeds the Perl interpreter, hard-code the Perl script as a string, then call the C-equivalent of Perl's eval on it. That would be studly. :-) Of course, you'd need access to one of their machines for development purposes and a compiler for each environment ... Good luck?


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

      Well, that was my plan by using Perl. The other obvious option is Rexx, but that would require a politically difficult installaiton on the Windows machine.

      I am really trying to avoid writing the same little application twice in two different scripting languages. I would rather not maintain multiple versions.

      Thanks

      Skip

      Even better: write a program that will translate the algorithm in your current script into several target languages, one being Perl, and the other being the language that is available on that system. Just as studly (or even moreso) as embedding the Perl interpreter, without having to touch C (unless, of course, that's the other target language).

        oooo! Fancy. Now I have THREE things to maintain. (The converter, the windows version, and the os/2 version.) I am trying to simplify a problem here.

        Seriously though, sometime a couple of years from now, somebody is going to have to figure out what I did here and make it work with whatever new conditions have come up. I don't want to make their job more difficult than absolutely necessary.

        Skip
Re: Perl Scripts on systems without perl environments.
by strfry() (Monk) on Nov 07, 2005 at 16:52 UTC
    i would suggest looking PAR/pp. it looks like it'll do what you're needing.

    on a sidenote, i recently used perl2exe to implement perl code (originally written under unix) on win32 platforms that didn't have the option to install a perl interpreter, and had little to no problem doing so. but it only works for unix and win32 platforms, so that wouldn't float your boat.

      perl2exe looks good, but does not appear to include OS/2.

      Skip
        I could swear you could run DOS commands in OS/2. perl2exe on the windows machine and move over to another computer?

        Investigate and reply, this is a stub reply since I don't know, myself.

        ----
        Give me strength for today..
        I will not talk it away..
        Just for a moment..
        It will burn through the clouds..
        and shine down on me.

Re: Perl Scripts on systems without perl environments.
by exussum0 (Vicar) on Nov 07, 2005 at 17:43 UTC
    "This is probably a foolish question, but I cannot find a good node about it."

    The most foolish question asked, is one that isn't. I commend you for looking first. Extra ++ on that. Information is hard to find, thus google, yellow pages, indexes and what not. Keep on askin'.

    ----
    Give me strength for today.. I will not talk it away..
    Just for a moment.. It will burn through the clouds.. and shine down on me.

      True. That's why I -- every question that wasn't asked. :)
Re: Perl Scripts on systems without perl environments.
by thundergnat (Deacon) on Nov 07, 2005 at 19:15 UTC

    Give PerlBin a look. I've never used it on os/2, but it claims "PerlBin is for you, whatever your OS may be, as long as there is a perl port for it" and that sounds pretty promising.

    I have used it before on Windows and it works fairly well. It is a little misleading, it doesn't pack everything into a single executable file, rather it make an executable that relies on an included custom built library directory, but it is fairly portable.

      Although the website doesn't reflect it, the author reccomends you use PAR

        Will PAR work on OS/2?

        Skip
Re: Perl Scripts on systems without perl environments.
by mikeock (Hermit) on Nov 09, 2005 at 15:49 UTC
    If it wasn't for OS2 I would say perl2exe. I have used it on the Win32 side and it works great!

      But, yet again, that does me no good. OS/2 is my stumbling block.

      Thanks

      Skip
Re: Perl Scripts on systems without perl environments.
by jesuashok (Curate) on Nov 07, 2005 at 16:16 UTC
    Hi,

    you have to write your own Makefile to check the System Architeture.

    then you have to build the Module dependancy accordingly.

    You can see these kind of Examples in many of the source code which comes with Unix and linux Flavours.

    ls command's source code is the best example for this

    "Keep pouring your ideas"
A reply falls below the community's threshold of quality. You may see it by logging in.