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

Re: pp with gui

by golux (Hermit)
on Apr 04, 2013 at 16:33 UTC ( #1027013=note: print w/replies, xml ) Need Help??

in reply to pp with gui

Hi mkmal,

I've been in the habit of using ASP's perlapp, but it unfortunately requires a paid license that not everyone wants to spend money for. (I'm lucky that I need it for work, and my company generously paid for the license).

So this seemed a good chance to learn an alternative approach.

I tried many of the same steps that you did, and got mostly the same results. Then I noticed you had modified your pp command to:

pp --gui -o gui2.exe -l C:/Perl/lib/auto/Tcl/tkki. dll -l +C:/Perl/lib/auto/Tcl/Tcl.dll
and I realized there was a typo in "tkki. dll" -- beside the extra space, it should be "tkkit.dll".

Once I changed that:

pp --gui -o gui1.exe -l C:/Perl/lib/auto/Tcl/tkkit.dll -l +C:/Perl/lib/auto/Tcl/Tcl.dll

the executable "gui1.exe" works as it should have.

You later said:

Here is the command I am using now. Please let me know if you see +any more errors. pp --gui -o gui1.exe -l C:/Perl/lib/auto/Tcl/tkkit.dll -l +C:/Perl/lib/auto/Tcl/Tcl.dll -x

I tried that as well, both with and without the -x; both worked ("gui1.exe" ran as expected). The only difference seemed to be that -x caused the gui to appear during compilation. Is it possible you *thought* you've corrected the "tkkit.dll" typo, but still have it (maybe in your "build" script?)

A few notes -- the app does startup kind of slowly, though (at least compared to apps I've built with "perlapp"). But when I run it a few more times, it seems to start quicker after the initial run.

It was fairly difficult to installing PAR::Packer (this was on a Windows 7 machine), at least for my ActiveState Perl environment. The thing that finally worked for me was:

C:\> ppm install MinGW C:\> cpanp i PAR::Packer

Update: added the prerequisite "ppm install MinGW"

Update 2: After installing on a different Windows 7 machine, I see that the tests fail for "ppm install MinGW":

Result: FAIL dmake: Error code 129, while making 'test_dynamic' dmake: Error code 255, while making 'subdirs-test'
It didn't seem to matter; answering 'y' to:
The tests for 'Win32::Exe' failed. Would you like me to proceed anyway or should we abort? Proceed anyway? [y/N]: y

was ultimately successful at installing "PAR::Packer" and "pp".

say  substr+lc crypt(qw $i3 SI$),4,5

Replies are listed 'Best First'.
Re^2: pp with gui
by marto (Bishop) on Apr 04, 2013 at 21:51 UTC


    "The only difference seemed to be that -x caused the gui to appear during compilation."

    -x actually runs the script to determine additional runtime dependancies. So if a GUI is in use then it'll be displayed.

    "Is it possible you *thought* you've corrected the "tkkit.dll" typo, but still have it (maybe in your "build" script?)"

    Possible, but it's hard to say given they copy and paste different things at different times and refuse to acknowledge the runtime warnings. You'll notice they provide different messed up pp calls at multiple times in the thread. Note that use of -gui isn't recomended if there are problems when running the executable created. It obscures the problem, as can be seen from several posts in this thread.

    "But when I run it a few more times, it seems to start quicker after the initial run."

    The first run will extract the whole zip file to a temporary area (for example C:\Documents and Settings\user\Local Settings\Temp\par-user), subsequent runs are quicker as they use this cache.

    Note that ActiveState currently don't provide a 64bit package for MinGW, so you need to install it yourself.

Re^2: pp with gui
by mkmal (Novice) on Apr 04, 2013 at 23:21 UTC
    Hey golux, you are awesome!!

    I was going through your post and at first I thought you made a typo when you said you ran 'cpanp i PAR::Packer'
    I thought you just accidently added a 'p' to cpan but a quick google introduced me to cpan plus.

    Figuring they may have a better version I uninstalled PAR::Packer using ppm.
    I attempted to run 'ppm install MinGW' but it said it was already installed (no missing packages). I then copied and pasted your 'cpanp' command.
    I didn't see any errors.
    Next, I ran the same pp command I had been running and gui1.exe was created without error which is what I had been seeing all along.

    I ran the .exe and for the first time it worked! A little slow the first time like you said.

    And to think I was just about ready to drop this issue for a while. Thanks again!
      Glad to hear it!

      Marto is right about the -x switch; I hadn't yet read that far in the pp docs, but now I see why "pp" would want to run the program first, to further evaluate what other modules (eg. DLLs) are needed.

      He's also correct about the cached files, it seems that using the -C (or --clean) switch to "pp" will:

      Clean up temporary files extracted from the application at runtime. By + default, these files are cached in the temporary directory; this all +ows the program to start up faster next time.

      I'm excited that this new way (for me) of packaging Perl programs seems an elegant (and cheap) alternative to ASP's "perlapp". I tried using it with Tk and it worked very smoothly.

      Here's my demo program; you can call it with --exe to build the executable:

      ## # PAR::Packer example using Tk # # Notes: # # 1. Run this script, and it creates a simple Tk App # 2. Install PAR::Packer in Windows using: # # C:\> ppm install MinGW # C:\> cpanp i PAR::Packer # # Don't worry if Win32::Exe tests fail: # # dmake.exe: Error code 129, while making 'test_dynamic' # dmake.exe: Error code @55, while making 'sudirs-test' # # Just select 'y' when prompted: Proceed anyway? [y/N]: y # # 3. To make the executable, type "<script> --exe" # # ############### ## Libraries ## ############### use strict; use warnings; use File::Basename; use Tk; ################## ## Main program ## ################## my $src = basename $0; (my $exe = $src) =~ s/[.]pl$/.exe/; if (@ARGV > 0 and $ARGV[0] eq '--exe') { my $cmd = "pp --gui -o $exe $src"; print "Command: $cmd\n"; system($cmd); exit; } # Tk Gui my $mw = new MainWindow(-title => 'PAR::Packer with Tk Example'); my $frm = $mw->Frame->pack(-expand => 1, -fill => 'both'); my $b1 = $frm->Button(-bg => '#ffefb3', -text => 'Hello World'); my $b2 = $frm->Button(-bg => '#ffefb3', -text => 'Quit (^Q)'); $b1->configure(-command => sub { print "Hello world!\n" }); $b2->configure(-command => sub { exit }); $b1->pack(-side => 'left'); $b2->pack(-side => 'right'); $mw->bind("<Control-q>" => sub { $b2->invoke }); $mw->MainLoop;
      say  substr+lc crypt(qw $i3 SI$),4,5

        You may also be interested in -T which allows you to specify a location for the cache. Out of interest have you tested using Strawberry Perl vs ActiveState?

        Thanks again. Now I have to go and learn how to use Tk beyond a simple test case.
        Do you have any suggestions on a good site.
        I've googled but it's always nice to hear what people in the know think.
Re^2: pp with gui
by mkmal (Novice) on Apr 04, 2013 at 19:39 UTC
    Wow, thanks. This is very helpful and I am going to check everything out. I'm glad I decided to look for posts one more time.

    >>Is it possible you *thought* you've corrected the
    >>"tkkit.dll" typo, but still have it (maybe in your
    >> "build" script?)

    I actually cut and pasted the exact command line I entered into my Console window (I'm not using a build script).

    Thanks again for posting this and I will report back my progress.

      "I am going to check everything out."

      I live in hope, but we've been round this loop several times before.

      "I actually cut and pasted the exact command line I entered into my Console window (I'm not using a build script)."

      It's inconsistent at various points throught your thread, either you didn't copy and paste it or you've made multiple mistakes when typing it several times. Consider testing paths actually exist, tab them out in the same way you do under linux/unix.

        No inconsistencies whatsoever. golux asked if I was sure that the command I was posting was what was really being entered. His thinking was sound, I could have been running script b but pasting what was in script a. I correctly informed him that I was actually running the command in the console window and I was cutting and pasting the actual command I ran when I got the behavior I was seeing. Note: I never said I typed the command into the command prompt every time, you just inferred that to make your point. It's a long command so I typed it into my command prompt the first time and then cut and pasted that into notepad. I would then cut and paste the command from notepad into my console window. That is why I had the same typo several times. When the typo was pointed out I ran the fixed command in my console and then copied that command to notepad. It is also why I inadvertently called the command later with --gui after I had removed it once for testing. I copied and pasted the command in my console window and removed the --gui. I neglected to remove it from notepad.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027013]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2017-11-23 01:01 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (327 votes). Check out past polls.