Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

How to make EXE file for Windows cmd window

by bulrush (Scribe)
on Dec 23, 2015 at 12:10 UTC ( #1151034=perlquestion: print w/replies, xml ) Need Help??
bulrush has asked for the wisdom of the Perl Monks concerning the following question:

I've been working on this for several months off and on, have read 40+ sites from Google searches, and I'm still stumped. I don't care what type of Perl I use, but Strawberry Perl and ActiveState just doesn't work for me to make an exe file from my perl code. I only need the EXE file made to work on Windows, I don't care which OS or Perl makes it.
  • pp and PAR::Packer cannot be installed on Strawberry Perl 5.18.2. It just doesn't work. I tried with cpanm, cpan, and ppm. It fails on all accounts.
  • The default Par::Packer from cpan that is gotten is 1.27, though the most recent version on CPAN says, as of yesterday, 1.28. I don't know why.
  • pp doesn't seem to install with most versions of Strawberry perl. PP has been broken for years with SP.
  • ActiveState perl has a lot of older modules, and some handy modules just aren't in their repo. So I can't use ActiveState.
  • Perl2exe doesn't work with any version of Strawberry perl. I already contacted their tech support.
  • I don't need to hide code, I just need to make an EXE file for a DOS box so people don't have to install perl, and can use my program.
  • Modules I need: Text::MultiMarkdown and Auto::Config, Date::Simple. Text::Wrap is optional.
  • I'm looking into CitrusPerl and Cava for Windows but I don't know how to find modules Citrus Perl has. ActiveState and Strawberry Perl both seem to have their own repos, so I assume Citrus also does. EDIT: Cava only works with perl 5.14 and some earlier versions. Has anyone tested Cava with Strawberry perl 5.14? How about SP 5.18.2?
So what are my options? Can I make a windows CLI exe file on Ubuntu perl?

Thank you so much, you all are very helpful. Happy holidays!

  • Comment on How to make EXE file for Windows cmd window

Replies are listed 'Best First'.
Re: How to make EXE file for Windows cmd window
by afoken (Abbot) on Dec 23, 2015 at 12:18 UTC
    Can I make a windows CLI exe file on Ubuntu perl?

    In the way that you want? No.

    Of course, you could write out bytes that represent a windows executable, from almost any version of perl running on almost any operating system.

    But wrapping a perl script, its requirements, and a perl interpreter into a Windows executable will most likely work only on Windows (simply because you neither have a windows based Perl interpreter on Ubuntu, nor you have the required compiler to compile XS modules for Windows). And even there, it's a bad idea. Better bundle perl (e.g. Strawberry) and your script and install that using an installer package like InnoSetup.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      But wrapping a perl script, its requirements, and a perl interpreter into a Windows executable will most likely work only on Windows
      I don't care on what OS the EXE is made on, I just need to make an EXE that works on Windows only. My problem, is so far, no Perl for Windows can make an EXE for me yet, for various reasons explained above.
Re: How to make EXE file for Windows cmd window
by Lotus1 (Curate) on Dec 23, 2015 at 16:20 UTC
    •pp and PAR::Packer cannot be installed on Strawberry Perl 5.18.2. It just doesn't work. I tried with cpanm, cpan, and ppm. It fails on all accounts.

    What errors do you see when you tried with cpan?

    •The default Par::Packer from cpan that is gotten is 1.27, though the most recent version on CPAN says, as of yesterday, 1.28. I don't know why.

    I downloaded the 1.28 version of PAR::Packer just now and transferred it to a server that is not web connected and installed it using dmake. It works. It's on Windows Server 2008 with Strawberry Perl 5.16.2 64 bit. I had to upgrade PAR to 1.010, 5.16.2 comes with a slightly older version. There were only a couple of other modules that I had to install. Getopt::ArgvFile and Module::ScanDeps. I already had Test::Requires.

    •pp doesn't seem to install with most versions of Strawberry perl. PP has been broken for years with SP.

    My workstation runs Windows 7 and has Strawberry Perl 5.18.2 installed. I just tested pp and it works. To see which version I have and what is available I opened the interactive cpan client from the command line and then did the following.

    cpan> i PAR Module id = PAR CPAN_USERID RSCHUPP (Roderich Schupp <rschupp@cpan.org>) CPAN_VERSION 1.010 CPAN_FILE R/RS/RSCHUPP/PAR-1.010.tar.gz UPLOAD_DATE 2015-07-13 MANPAGE PAR - Perl Archive Toolkit INST_FILE C:\strawberry\perl\vendor\lib\PAR.pm INST_VERSION 1.007 cpan> i PAR::Packer Module id = PAR::Packer CPAN_USERID RSCHUPP (Roderich Schupp <rschupp@cpan.org>) CPAN_VERSION 1.027 CPAN_FILE R/RS/RSCHUPP/PAR-Packer-1.028.tar.gz UPLOAD_DATE 2015-11-19 MANPAGE PAR::Packer - PAR Packager INST_FILE C:\strawberry\perl\vendor\lib\PAR\Packer.pm INST_VERSION 1.025

    The file version above shows 28 but CPAN thinks it is 27. I just did an "install PAR::Packer" and it worked. INST_VERSION is now 1.028. I just ran pp and created an exe that runs.

    If you don't want to try a fresh install of Strawberry Perl you might try the portable version. You can install that to its own folder on your hard drive and then run cpan from its command line.

Re: How to make EXE file for Windows cmd window
by james28909 (Chaplain) on Dec 23, 2015 at 13:33 UTC

    You should check out the Perl Dev Kit. I have the latest PDK and it works lovely. You can also script GUI's and pack them with PDK as well. I have a multi-tool going and its all scripted in perl and packed with PDK.

    EDIT: Also I should add that I am running Active State Perl version 5.16.3 and the latest PDK. Ive also noticed alot of modules are not readily available for the newer versions of AS Perl, which is why I stay on 5.16.3.

    EDIT 2: Also, even with AS Perl, I install many modules from CPAN. and also with AS PPM you can add more repos as well.
      Is PDK free?
        It has a 30 day trial.
      Geez, I can't afford $300 for PDK.
        Or you can send me the script and I can pack it into an exe for you
        I also sent you some more info via /msg
Re: How to make EXE file for Windows cmd window
by soonix (Monsignor) on Dec 23, 2015 at 19:25 UTC
      indeed
      perl -V:myuname && which pp.bat myuname='Win32 strawberryperl 5.14.2.1-portable #1 Tue Nov 22 18:24:29 + 2011 i386'; C:\path\strawberry\perl\bin\pp.bat

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: How to make EXE file for Windows cmd window
by dbuckhal (Pilgrim) on Dec 24, 2015 at 03:21 UTC

    Assuming you have a Windows platform available, I've been successful with just downloading a version of Strawberry Perl Portable to compile exe's using PAR::Packer. Just unzip to a directory, double-click on the portableshell batch file, install your needed modules in that CPAN, and see if that works for you.

    Hope it helps!

Re: How to make EXE file for Windows cmd window
by Anonymous Monk on Dec 23, 2015 at 23:31 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1151034]
Front-paged by Corion
help
Chatterbox?
[karlgoethebier]: ...good Hot tuna. Note the stacks & racks in the background
[karlgoethebier]: ..the last hippies. They still perform. At least the survivors...
[Discipulus]: not survived
[Discipulus]: has pm some danish monk?
[Discipulus]: erix the problem was not rain in the brain.. ;=)

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-11-17 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?