Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

EXE from Script (Re: General advice desperately needed)

by soonix (Canon)
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 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" {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?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1137816]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-01-18 22:08 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (54 votes). Check out past polls.