Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Running perlscript on windows sytems that don't have Perl installed

by ozgurp (Beadle)
on Jun 06, 2003 at 00:29 UTC ( #263564=perlquestion: print w/replies, xml ) Need Help??

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

Dear Monks,

I have a perl code that I need to run on windows systems without perl installed. I have tried copying perl.exe into a directory and run the script with it. But it can not find perl*.dll then I tried to copy perl*.dll into WINNT/system32. Then it could not find strict.pm. Basically I need to install perl with only required files and run my script. Any suggestions?

Thanks

  • Comment on Running perlscript on windows sytems that don't have Perl installed

Replies are listed 'Best First'.
Re: Running perlscript on windows sytems that don't have Perl installed
by arthas (Hermit) on Jun 06, 2003 at 00:40 UTC

    You might be better of with compiling your Perl script. Some softwares for doing this are Perl2Exe, PerlApp and perlcc. This PM node has some information about them.

    Anyhow, is there a particular reason you can't perform a full Perl installation?

    Michele.

      I am already using PerlApp. I have a code that extracts certain type of elements from a text file. These elements have names like QUAD, CBAR, CROD. I have a while loop that reads the files line by line and extracts required info.
      while(<FH>){ if($_ =~ C B A R){ do something } if($_ =~ Q U A D){ do something } if($_ =~ C R O D){ do something } if($_ =~ C B E A M){ do something } if($_ =~ C E L A S 1){ do something } ... }
      Now the problem is I have 38 different element types and 20 files with 100 MB info in total abot 2 GB. If I have a fixed code then it takes too long to read these files. My solution was to quickly re constract my code based on user selection and run that code instead of the fixed long one. So the new script will only be looking for selected elements in the while loop. I will open a new file newcode.pl write reconstracted algorithm into that code and close it. and then run it. This will prevent the code looking for unwanted elements and significantly reduce the time spent.
      while(<FH>){ if($_ =~ C B A R){ # selected element do something } if($_ =~ Q U A D){ # selected element do something } }
      I will have an .exe file doing this (PerlApp) but I can not compile the reconstructed code with PerlApp. Because the users of this program will not have PerlApp on their machines, they will not have perl on their machines either. So how can I run this reconstructed script.
        Instead of rewriting the perl script and so forth, why not just just have a hash containing all the regexes and simply interpolate which ever one you want, i.e.
        my $regex="C B A R"; #however you choose to define it while(<FH>) { if(/$regex/o) # do something; }
        PerlApp does exactly what you want, but behind the scenes. you should look into --add to include extra modules in the exe. It extracts them in $ENV{TEMP}/PDK and sets the lib to there. (yeah this skips some detail) I really would like to see the technique you're using on this.
        One thing to note is that PerlApp and Perl2Exe dont compile your app per se. they simply put every file needed in a self-extracting wrapper. You can also embed files in the exe and use a module (sorry don't know exactly.. PerlApp.pm maybe?) to pull the files back out at runtime.

        Hope I helped!

        mhoward - at - hattmoward.org

        Sure you can have your PerlApp or Perl2Exe program "compile" another Perl-program. Just write your "new" Perl-program to a file or keep it in a scalar and then do or eval it.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

        Stylistic issues aside (you don't need to name $_, you can just do if(m/C B A R/), but I digress), you could probably speed up your code if your test cases are mutually exclusive. That is to say that if 'CBAR' and 'QUAD' will never appear on the same line, you can use elsif instead of if. The elsif will short circuit, thereby eliminating a ton of pattern matches. For more speed, put the more common cases towards the top of the chain of if..elsif..elseif so that it short circuits as early as possible.

        HTH,
        thor

Re: Running perlscript on windows sytems that don't have Perl installed
by BrowserUk (Patriarch) on Jun 06, 2003 at 01:30 UTC

    I think BUUs suggestion is the best answer to your specific problem, but if your user are connected, its not hard to install perl on a server and let them access it via the network. Your SysAdmin guys ought to be able to set this up for you in a twinkling of an eye. Management approval forthcoming of course:)


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Re: Running perlscript on windows sytems that don't have Perl installed
by fglock (Vicar) on Jun 06, 2003 at 00:53 UTC

    See also TinyPerl from perlmonk gmpassos.

    TinyPerl is small and malleable, making a good tool for publishing. From the version 2.0 TinyPerl can get your script.pl and turn it into a binary (script.exe).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://263564]
Approved by arthas
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2022-05-23 15:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?