BUU has asked for the wisdom of the Perl Monks concerning the following question:

I'm running activestate perl 5.8 on windows2000. I installed PAR and Wx via the ppm.bat utility. They both install fine and work fine, I.e. my test Wx script:
#!/usr/bin/perl -w use strict; use Wx; ########################################################### # # Define our HelloWorld class that extends Wx::App # package HelloWorld; use base qw(Wx::App); # Inherit from Wx::App sub OnInit # Every application has its own OnInit method that will # be called when the constructor is called. { my $self = shift; my $frame = Wx::Frame->new( undef, # Parent window -1, # Window id 'Hello World', # Title [1,1], # position X, Y [200, 150] # size X, Y ); $self->SetTopWindow($frame); # Define the toplevel window $frame->Show(1); # Show the frame } ########################################################### # # The main program # package main; my $wxobj = HelloWorld->new(); # New HelloWorld application $wxobj->MainLoop;
works fine when I run it from the command line, "perl wxtest.pl". I get my nice window and stuff. I have another simple test script, test.pl which just contains print "hi". Then I did pp -o test.exe test.pl. The produced test.exe works fine and prints "hi".

However when I run pp wxtest.pl; I get a nice executable named 'a.exe', but when I try to run it from the command line, nothing happens. It just returns instantly. I then switched to the filemanger and tried to run it by double clicking. The first time I double click it, I get a nice wx window and a dos box. I close this, then click on a.exe again. A dos box flashes and goes away instantly. No window. I double click it again, I get the wx window and a dos box. This repeats for as long as I've tried it.

I'm guessing this is some bug with how PAR is extracting the files it contains, but I have no clue what to do about it. Anyone ever heard of anything like this?

Replies are listed 'Best First'.
Re: Par, Wx oddities, win2k
by kutsu (Priest) on Oct 09, 2003 at 20:46 UTC

    I've had something like this in that the dos box prints and finishes to quickly to see. Try putting a break at the end, sleep 5 or print "hit any key\n"; chomp($dummy=<STDIN>); might work. Just a thought.

    "Pain is weakness leaving the body, I find myself in pain everyday" -me

      Well, I tried adding a "<>;" at the end of the script (after the mainloop function is called), and now I can't run it from the file manager but running it from the command line gives me the same first it works, then it doesn't as before.