Hi all,

I'm trying to create a completely stand-alone exe using pp (ie without using any 
external libraries at all) and I'm having a few problems (and can see a few more 
coming).

First off, I'm altering the par file so that I can modify @INC - this is to get around 
 the problem of pp leaving @INC full of all the normal paths using perl 5.8.1+.

This is done with:

use Archive::Zip;
$zip = Archive::Zip->new;
$zip->read('out.par');
my $file = $zip->memberNamed('script/main.pl');
my $contents = $file->contents;
$zip->removeMember('script/main.pl');
$zip->addString("[EMAIL PROTECTED] = (\$INC[0], '.'); print \"[EMAIL PROTECTED]";\n" . 
$contents, 'script/main.pl');
$zip->writeToFileNamed('out2.par');

I left '.' in the path as there is a config package that needs to root itself using 
@INC.

Anyway, on the first trial, it came back with this:

# ./search
CODE(0x84529c8) .
./search
Can't locate loadable object for module Tk::NBFrame in @INC (@INC contains: ../../.. 
CODE(0x8413234) CODE(0x84529c8) .) at ../blib/lib/PAR/Heavy.pm line 101
Compilation failed in require at (eval 34) line 3.
        ...propagated at /usr/local/lib/perl5/5.8.1/base.pm line 70.
BEGIN failed--compilation aborted at Tk/NoteBook.pm line 15.
Compilation failed in require at IMS/Search/GUI.pm line 9.
Compilation failed in require at IMS/Search/Globals.pm line 6.
Compilation failed in require at script/search line 11.

Tk::NBFrame bootstraps off of auto/Tk/NBFrame/NBFrame.bs (and 
auto/Tk/NBFrame/NBFrame.so), so I added two -M switches to the pp -p call like so:

-M auto/Tk/NBFrame/NBFrame.bs -M auto/Tk/NBFrame/NBFrame.so

but pp complained thus:

'auto/Tk/NBFrame/NBFrame.bs' does not exist or is not readable; skipping
'auto/Tk/NBFrame/NBFrame.so' does not exist or is not readable; skipping

NBFrame.so is found in 
/usr/local/lib/perl5/site_perl/5.8.1/i386-freebsd-64int/auto/Tk/NBFrame/NBFrame.so

/usr/local/lib/perl5/site_perl/5.8.1/i386-freebsd-64int is in @INC, and the doco for 
the -M switch states that @INC is searched for the specified file, but I could only 
get it to work when I specified the whole path. Not a biggy, but annoying. (Also maybe 
have -M look in 'auto' subdirs of @INC for files with .bs extensions?)

Anyway, even when this was done, -M dropped the two files into the root of the zip. 
When the script was completely compiled and run I still got the error above - ie the 
'bootstrap' function (in DynaLoader) couldn't find the relevant files. (Remember that 
@INC does not include the standard libraries, so it has to depend on the contents of 
the original par file).

Is there a way around this (other than modifying the par file even further)?

I just can't wait until I get to the bit with MySQL libraries :)

MB

Reply via email to