http://qs321.pair.com?node_id=913229

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

Hi All,

I have developed a perl GUI application using Wx::Perl. The front end was developed using wxGlade and the application is working as expected when I run it from Padre or cmd. Now I want to build an exe of my application. So I used PAR::Packer (pp) to build the exe. After many attempts I was able to built an exe (I got many missing dll and Wx module error and I added them all manually).

Now I have got two issues:

1. The generated exe is not showing the GUI. It just exists after hanging for few seconds. No errors, nothing. After a long debugging/rebuilding I was able to find the cause. My main program is as bellow (It was generated by xwGlade)

package main; unless(caller){ local *Wx::App::OnInit = sub{1}; my $app = Wx::App->new(); Wx::InitAllImageHandlers(); my $provisioning = provisioningChecklist->new(); $app->SetTopWindow($provisioning); $provisioning->Show(1); $app->MainLoop(); }

I found out that the exe is not entering the 'unless' block. If I comment out the 'unless' condition and rebuild the exe, GUI works.

So what is this 'caller' and why is it not running when I pack it using PAR::Packer, but works fine if it is run as normal perl script?

2. My Application uses a Marquee style progress bar while it populates the data in background. It is implemented using two threads. The logic is as below:

THREAD 1 enters a loop, generates an EVENT and sleeps for few milliseconds. The loop is controlled by a shared variable. The main program catches the EVENT and fires Wx::Gauge->Pulse;

THREAD 2 does the actual work and result is set in shared variable. An EVENT is fired and the main program catches it and populates the grid with the result. After all the work is done, shared variable is set to stop the THREAD 1 loop and an EVENT is generated to destroyed the progress bar.

This works fine when I run the script from cmd or Parde. But when I run the exe, progress bar window appears but the gauge is not moving. However the grid is populated with data. I am confused with the behaviour and dont know how to debug the exe. Any help on how to proceed further is greatly appreciated.

English is not my native language, hence forgive me for any mistakes and for the long post.

"Experience is the child of thought, and thought is the child of action."