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

Dear fellow monks,
I am trying to create a standalone perl executable for a Perl/Tk application. To this aim, I used the pp command with the -l option in order to include all required modules:
pp -vvv -l C:\Perl\lib -l C:\Perl\site\lib -o program.pl program.exe
When I try to run my exe, I get the following error:
Can't locate POSIX.pm in @INC (@INC contains: CODE(0x1f0ef80) C:\Users +\ADMINI~1\AppData\Local\Temp\par-Administrator\cache-17f4ea2f953b4df5 +d967d28be8eb4c9a4937753f\inc\lib C:\Users\ADMINI~1\AppData\Local\Temp +\par-Administrator\cache-17f4ea2f953b4df5d967d28be8eb4c9a4937753f\inc + CODE(0x17c5f40) CODE(0x17c60b4)) at script/program.pl line 37. BEGIN failed--compilation aborted at script/program.pl line 37.
Then I specifically tried adding the POSIX module to my pp command as follows:
pp -vvv -l C:\Perl\lib -l C:\Perl\site\lib -a C:\Perl\lib\POSIX.pm -o +program.pl program.exe
I see the module being added as command runs :
\site\bin/pp: ... adding C:/Perl/lib/POSIX.pm as Perl/lib/POSIX.pm
but I get the same error at runtime.

My OS is Windows Vista Home Premium, I have just updated cpan with the latest updates, I have ActivePerl-5.8.8.822-MSWin32-x86-280952 and finally got PAR::Packer 0.982 from cpan. If of any use, the starting bit of my program.pl with the module requirements is as follows
use threads; use threads::shared; #setup thread code before any Tk code my $thread_data1 : shared; $thread_data1; my $thread_die1 : shared; $thread_die1 = 0; my $thread_go1 : shared; $thread_go1 = 0; my $thread1 = threads->new(\&work); my $thread_data2 : shared; $thread_data2; my $thread_die2 : shared; $thread_die2 = 0; my $thread_go2 : shared; $thread_go2 = 0; my $thread_user2 : shared; $thread_user2; my $thread_pass2 : shared; $thread_pass2; my $thread2 = threads->new(\&setconn); use Time::HiRes; use Tk; use Tk::Icon; use Tk::TopLevel; #use Tk::ProgressBar; use utf8; use Win32; use Win32::TieRegistry; use Win32::OLE('in'); use Win32::OLE qw(EVENTS); use Net::UPnP::ControlPoint; use Net::Telnet; use POSIX":sys_wait_h";
I would highly appreciate any help as I 've been looking at this since yesterday and am at a total loss!

Regards,
Athanasia

Replies are listed 'Best First'.
Re: Problem with POSIX.pm module using pp
by Anonymous Monk on Oct 23, 2008 at 03:09 UTC
    It seems to be a bug in Module::ScanDeps (pp depends on it), as it doesn't recognize the unorthodox use POSIX":sys_wait_h"; (it does recognize use POSIX ":sys_wait_h"; or use POSIX(":sys_wait_h");
    scandeps -B program.pl pp -o program.exe program.pl pp -MPOSIX -MModule::Name ... -o program.exe program.pl
      That fixed the issue. Thanks a lot!

      Athanasia

        Please report such issues as bugs when you find them. We do try hard to maintain Module::ScanDeps as a dependency of PAR::Packer and I generally read what happens on Perlmonks, but that's not a given.

        This being said, I'll try to fix the issue in M::SD (so no need to report this time). Eventhough I'm not particularly happy that I have to look at Module::ScanDeps::scan_chunk() again...

        Update: Module::ScanDeps 0.86 will be fixed in this regard. I also found another bug while I was at it!