http://www.perlmonks.org?node_id=1022592

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

Hi PerlMonks,
running this little script in 'non-pp'-mode works fine. 'pp'-mode does'nt like it. I am sure, some modules have to be included - but I can't figure out which ones.
Would somebody be so kind to point me in the right direction. Thanks in advance!

Linux Mint 14 using Perl v5.14.2
=========== sample_getSaveFile.pm ==================================== +========= #!/usr/bin/perl use Tk; $mw = MainWindow->new(-title => 'sample_getSaveFile'); my $DOC_filetypes = [['Text', '.txt'], ['Any File', '.*']]; my $i = $mw->getSaveFile(-defaultextension => '.myown', -filetypes => $DOC_filetypes, -initialdir => '.', -initialfile => 'xyz', -title => 'getSaveFile'); if (defined $i) { print 'Successful getSaveFile'; } else { print 'Error on getSaveFile'; } MainLoop; =========== PAR Packager, version 1.012 (PAR version 1.005) ========== +============== pp -C --vvv -L pp_logifle.txt -o sample_getSaveFile sample_getSaveFile +.pm =========== running sample_getSaveFile =============================== +============== Can't locate Tk/Bitmap.pm in @INC (@INC contains: CODE(0x8c40cfc) CODE +(0x8c410bc)) at Tk/Widget.pm line 270. at Tk/Widget.pm line 203 =========== after including 'use Tk::Bitmap;', running 'pp' and execut +ing 'sample_getSaveFile' the following message appears: ======== XS_Tk__Callback_Call error:must specify one of -data, -file, -array or + -id at Tk/Image.pm line 21. Tk::Error: must specify one of -data, -file, -array or -id at Tk/Image +.pm line 21. Tk callback for image Tk::Image::new at Tk/Image.pm line 21 Tk::Image::__ANON__ at Tk/Image.pm line 63 Tk::FBox::Update at Tk/FBox.pm line 404 Tk::After::once at Tk/After.pm line 90 [once,[{},after#13,idle,once,[{},Update]]] ("after" script) ====================================================================== +=================

Replies are listed 'Best First'.
Re: Problem with getSaveFile in 'pp'-mode
by marto (Cardinal) on Mar 09, 2013 at 17:42 UTC

    Like your previous post, you're going to have to tell us what doesn't work. How do I post a question effectively?.

    update: ignore.the above. Can you show.how you used pp to build this? Did you use the -x flag?

      I tried to describe the problem in 4 steps:
      1. line 3-33 is the script. When executing as 'perl sample_getSaveFile.pm' it works fine.
      2. line 37: using PAR::Packer to package the very same script (from step 1) into a binary executable.
      3. line 41-42: Executing the generated binary executable from step 2 show error messages
      4. line 46-55: after including 'use Tk::Bitmap' into the script (line 3-33) and running the PAR::Packer again (step 2) the executable shows different error messages.

      My question: "what am I doing wrong or what modules have to be included to satisfy PAR::Packer?"
      see line 37 please.

        Sorry, not my day. You want to call pp with -x. See the pp documentation. Note that this is lowercase rather than uppercase x. Go ahead and add -x to your pp arguments and test the resulting executable

Re: Problem with getSaveFile in 'pp'-mode
by ww (Archbishop) on Mar 09, 2013 at 17:11 UTC
    Ln 41, 42 ?

    If you didn't program your executable by toggling in binary, it wasn't really programming!

      How do I have to interpret 'Ln 41-42'?
        One plausible interpretation?

        Read the error msg shown at Lines 41 - 42 in your original post.


        If you didn't program your executable by toggling in binary, it wasn't really programming!