Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

EXE from Script (Re: General advice desperately needed)

by soonix (Monsignor)
on Aug 07, 2015 at 09:25 UTC ( #1137816=note: print w/replies, xml ) Need Help??


in reply to General advice desperately needed

I have successfully produced .exe files with pp (Tk included):
  • I used the "portable" version of Strawberry
  • installed Tk from CPAN
  • installed PAR::Packer from CPAN (which contains pp)
  • for changing the application Icon (for double-clicking), I installed Win32::Exe from CPAN
  • for the title bar logo, I grabbed and adapted Tk::ToplevelIcon from Re: Perl TK changing the logo
  • then created the .exe like this:
    cmd /c pp -v -g -o xxxxx.exe xxxxx.pl perl -e "use Win32::Exe; $exe = Win32::Exe->new('xxxxx.exe'); $exe->se +t_single_group_icon('xxxxx.ico'); $exe->write;"
The resulting .exe takes relatively long to startup because pp essentially makes a copy of perl's runtime system which has to be unpacked more or less on every run.

As I'm the Admin anyway, I found it better to copy the perl folder and the folder containing script + additional needed files to the target and create a .lnk with target "{perl folder}\perl\bin\wperl.exe" xxxxx.pl {additional parameters}, and execute in the folder that contains the script.

P.S. the "cmd /c" is there because actually, I put it into a .cmd batch, and pp is also a .cmd a .bat file. Now that I think of it, I should have made a perl script and calling pp from there…

Update: Still not optimal (argument setting for pp, error checking), but here you go:
use 5.011; # implies strict + feature 'say' use warnings; use pp; use Win32::Exe; my $name = shift; my ( $script, $exefile, $icon ) = map { "$name.$_" } qw(pl exe ico); say "creating $exefile from $script"; @ARGV = qw(-g -o); push @ARGV, $exefile, $script; pp->go(); say "setting icon from $icon"; my $exe = Win32::Exe->new($exefile); $exe->set_single_group_icon($icon); $exe->write;

Replies are listed 'Best First'.
Re: EXE from Script (Re: General advice desperately needed)
by Anonymous Monk on Aug 08, 2015 at 00:14 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1137816]
help
Chatterbox?
and the grasshoppers chirp...

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













    Results (295 votes). Check out past polls.

    Notices?