Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: pp with gui

by mkmal (Novice)
on Apr 04, 2013 at 23:21 UTC ( #1027045=note: print w/ replies, xml ) Need Help??


in reply to Re: pp with gui
in thread pp with gui

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!


Comment on Re^2: pp with gui
Re^3: pp with gui
by golux (Pilgrim) on Apr 05, 2013 at 00:19 UTC
    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
      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.
        The main way I've gotten experience in perl/Tk is via the book "Learning Perl/Tk" from O'Reilly, by Nancy Walsh.

        There are so many great things you can do with perl/Tk, and it's platform agnostic, so anything I write for Linux is useable under Windows as well.

        Try writing some simple applications that are of interest to you, and let us know when you have any questions. ;)

        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?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-09-21 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls