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


in reply to wxperl + PAR::Packer + GUI not working

I don't know about the rest -- but for the 'caller' bit: caller() returns information about the sub that called the current sub. In the code that you gave, caller would normally return nothing when called as a regular script because nothing _called_ this code, instead this code is where everything starts.

What must be happening is that in PAR there is some script that kicks off, and then does a 'do' or similar on your script.

You might be able to illustrate this to yourself by dumping out a stack trace. Just above your 'unless', put:

use Carp qw( cluck ); cluck('Dumping stacktrace!');

That will print out the whole callchain. Now run your program directly, and then again from a PAR exe, and note the difference.

Replies are listed 'Best First'.
Re^2: wxperl + PAR::Packer + GUI not working
by alfoos (Initiate) on Jul 07, 2011 at 20:42 UTC

    Hello awwaiid,

    Yes, you are correct. I performed the step you told and following are the result:

    Stack output when the script is run normally

    Dumping stacktrace! at C:\Users\VPS3159Admin\Desktop\New folder\checkl +ist.pl line 897 Dumping stacktrace! at C:\Users\VPS3159Admin\Desktop\New folder\checkl +ist.pl line 899 Subroutine Wx::App::OnInit redefined at C:\Users\VPS3 +159Admin\Desktop\New folder \checklist.pl line 903.

    Stack output when from exe

    Dumping stacktrace! at script/checklist.pl line 897 require main called at C:/strawberry/perl/vendor/lib/PAR.pm li +ne 636 PAR::_run_member('Archive::Zip::ZipFileMember=HASH(0x329f3bc)' +, 1) cad at script/main.pl line 26 require main called at C:/s +trawberry/perl/vendor/lib/PAR.pm line 636 PAR::_run_member('Archive::Zip::ZipFileMember=HASH(0x329f58c)' +) callet C:/strawberry/perl/vendor/lib/PAR.pm line 428 PAR::import('PAR') called at -e line 953 eval {...} called at -e line 209 __par_pl::BEGIN() called at script/checklist.pl line 0 eval {...} called at script/checklist.pl line 0 Dumping stacktrace! at script/checklist.pl line 899 require main called at C:/strawberry/perl/vendor/lib/PAR.pm li +ne 636 PAR::_run_member('Archive::Zip::ZipFileMember=HASH(0x329f3bc)' +, 1) ca d at script/main.pl line 26 require main called at C:/strawberry/perl/vendor/lib/PAR.pm li +ne 636 PAR::_run_member('Archive::Zip::ZipFileMember=HASH(0x329f58c)' +) callet C:/strawberry/perl/vendor/lib/PAR.pm line 428 PAR::import('PAR') called at -e line 953 eval {...} called at -e line 209 __par_pl::BEGIN() called at script/checklist.pl line 0 eval {...} called at script/checklist.pl line 0

    When the script is run normally there is no caller, but when then the exe is executed main.pl calls my main program

    Thank you for your valuable input

    I am still debugging my second issue and will update here if I am able to fix it

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