One comment about midway down.
~ Garyl

Malcolm Nooning wrote:


Garyl Erickson wrote:

I'm seeing what looks to be the same problem with -c and -x using my own simple scripts (on Windows XP, using ActivePerl 5.8.8 b817). As a new user of PAR, I was experimenting with require() and use(). The interesting thing is, whenever I get the mkdir error, if I run the executable a second time (and subsequent times), it works fine.


Here's my experiment in detail: t1.pl is in my working dir, t1b.pl is in a sub-directory named mylib.

----- t1.pl -------------------------------------------------------------------
use warnings;
use strict;

use lib "mylib";

print "\n> t1: [EMAIL PROTECTED] = " . join(",\n  ", @INC) . "\n";

require 't1b.pl';

print "\n> t1: \%INC = " . join(",\n  ", values %INC) . "\n";

DoIt();
-------------------------------------------------------------------------------


----- mylib/t1b.pl ------------------------------------------------------------
use warnings;
use strict;

sub DoIt() {
   print "\nDid it (mylib/t1b.pl).\n"
}

1;
-------------------------------------------------------------------------------

If I execute "pp -o t1.exe t1.pl" and run the resultant t1.exe, I get a "Can't
locate t1b.pl in @INC" error:
Can't locate t1b.pl in @INC (@INC contains: CODE(0xf0d7cc) C:\DOCUME~1\GARYL~ 1.VEI\LOCALS~1\Temp\par-garyl\cache-0ec73c4d9f4028bc48fbafc0b06ffc177bc894c d\inc\lib C:\DOCUME~1\GARYL~1.VEI\LOCALS~1\Temp\par-garyl\cache-0ec73c4d9f4
   028bc48fbafc0b06ffc177bc894cd\inc CODE(0xe23944) CODE(0xe23a7c)) at
   script/t1.pl line 8.
     (previous line split to fit)
Is pp or ScanDeps not able to find this require based on the use lib?

If I execute "pp -c -o t1.exe t1.pl", the first time I run the resultant t1.exe, I get the mkdir error: mkdir C:\DOCUME~1\GARYL~1.VEI\LOCALS~1\Temp\par-garyl\cache-0ec73c4d9f4028bc4
   8fbafc0b06ffc177bc894cd/inc/lib/C:/: Invalid argument at
   C:/Perl/site/lib/Archive/Zip.pm line 659
     (previous line split to fit)
Subsequent times I run it, I get the "Can't locate t1b.pl in @INC" error. Again, is pp or ScanDeps not able to find this require?

If I execute "pp -x -o t1.exe t1.pl", it always runs as expected.

Besides the mkdir error, is this how PAR is expected to handle a require -- you
have to run the script using pp -x for PAR to pick it up?


With a few changes to t1.pl to use a full path to mylib in the use lib statement, I get slightly different results.

----- t1.pl -------------------------------------------------------------------
use warnings;
use strict;

use FindBin qw($Bin);
print "\n> t1: \$Bin=$Bin\n";

use lib "$Bin/mylib";

print "\n> t1: [EMAIL PROTECTED] = " . join(",\n  ", @INC) . "\n";

require 't1b.pl';

print "\n> t1: \%INC = " . join(",\n  ", values %INC) . "\n";

DoIt();
-------------------------------------------------------------------------------

The results using "pp -o t1.exe t1.pl" and "pp -c -o t1.exe t1.pl" are the same as before. But if I execute "pp -x -o t1.exe t1.pl", the first time I run the
resultant t1.exe, I get the mkdir error, but subsequent times run fine.


Just for kicks, I changed the first t1.pl yet again -- I removed the use lib statement entirely and changed the require to 'mylib/t1b.pl'. In this case, the resultant executable always ran as expected, regardless of whether or not I used the (unnecessary) -c or -x.


I also repeated the tests using a module. I turned mylib/t1b.pl into a trivial module by simply renaming it mylib/t2b.pm, and created t2.pl, as follows:

----- t2.pl -------------------------------------------------------------------
use warnings;
use strict;

use mylib::t2b;

print "\n> t2: [EMAIL PROTECTED] = " . join(",\n  ", @INC) . "\n";
print "\n> t2: \%INC = " . join(",\n  ", values %INC) . "\n";

DoIt();   # in module t2b
-------------------------------------------------------------------------------

These all pp'd and ran fine, with or without the (unnecessary) -c or -x, as expected.

... Hopefully adding some more clues ...

Garyl



Malcolm Nooning wrote:

Here is a new wrinkle.
I updated AutoLoader to 5.63

I did
nmake clean
perl -MConfig_m Makefile.PL
nmake
nmake test

Now all of the automated_pp_test.pm tests pass, including the "pp -c hello.pl" test, but only via the "nmake test". I did the "nmake test" twice and it all passed both times.

As before, doing "pp -c hello.pl" directly from the command line, including in a directory that has no spaces in the path name, and then running the resulting "a.exe" fails. As before, it fails in the same way. Namely, with the Invalid argument at C:/perl/lib/Archive/Zip.pm line 659

I did a print out in PAR::Packer and I could not see any %ENV elements that have to do with par/pp/perl, other than having perl in the PATH.


... Just trying to add to the clues ...



That is because pp did not find the lib. You do not get warnings if pp does not find a lib, by the way.

When you are using pp and you want to make sure a lib is included that is not in the normal @INC path, or PERL5LIB, I think you need to use the --lib, as in the two examples below.


I verified that using --lib does indeed avoid the missing lib errors I saw, but I'm surprised it's required. Running "pp --lib mylib -o t1.exe t1.pl" (without a "use lib 'mylib'" statement in t1.pl) apparently makes use of the "require 't1b.pl'" statement in t1.pl because only the required t1b.pl file and no others in mylib get included in the PAR. (At least that's true in the expanded cache tree created in the TEMP dir by running t1.exe and in a .par file if I add -p to the pp command.) So I really expected pp to be able to make use of the "use lib 'mylib'" statement and add the specified lib to @INC without having to specify it with --lib. Is this expected behavior?

pp --lib /foo hello.pl -o output_file input_file.pl
pp --lib /foo --lib bar hello.pl -o output_file input_file.pl

Here is the command that works, at least on my machine:

C:\aaa>pp --lib c:\aaa\mylib -o t1.exe t1.pl

--------paste results
C:\aaa>
C:\aaa>pp --lib c:\aaa\mylib -o t1.exe t1.pl
Set up gcc environment - 3.4.2 (mingw-special)

C:\aaa>t1

> t1: @INC = CODE(0x1027850),
C:\DOCUME~1\malcolm\LOCALS~1\Temp\par-malcolm\cache-829b3fb1038d441c8df37c2083d9e6eef2ccfc26\inc\lib, C:\DOCUME~1\malcolm\LOCALS~1\Temp\par-malcolm\cache-829b3fb1038d441c8df37c2083d9e6eef2ccfc26\inc,
 CODE(0xef8d08),
 CODE(0xef8e40)

> t1: %INC = /loader/HASH(0x9d17b0)/IO/Handle.pm,
 /loader/HASH(0x9d1c30)/re.pm,
 /loader/HASH(0x9d1840)/List/Util.pm,
 /loader/HASH(0x9d18d0)/SelectSaver.pm,
 /loader/HASH(0x9ac9b8)/ActiveState/Path.pm,
 /loader/HASH(0x9b36e4)/Compress/Zlib.pm,
 /loader/HASH(0x9d1a38)/auto/DynaLoader/dl_findfile.al,
 /loader/HASH(0x9d1960)/Time/Local.pm,
 /loader/HASH(0x9b39fc)/File/Find.pm,
 /loader/HASH(0x9b37bc)/Cwd.pm,
 /loader/HASH(0x9b34ec)/warnings.pm,
 /loader/HASH(0x9b369c)/Carp/Heavy.pm,
 /loader/HASH(0x9b3924)/Fcntl.pm,
 /loader/HASH(0x9d1918)/Symbol.pm,
 /loader/HASH(0x9d1888)/Scalar/Util.pm,
 /loader/HASH(0x9b3894)/Exporter.pm,
 /loader/HASH(0x9d16d8)/File/Temp.pm,
 CODE(0x11165c0),
 /loader/HASH(0x9b357c)/PAR.pm,
 /loader/HASH(0x9b384c)/Errno.pm,
 /loader/HASH(0x9b3ad4)/File/Spec.pm,
 /loader/HASH(0x9b3a44)/File/Glob.pm,
 /loader/HASH(0x9b3a8c)/File/Path.pm,
 /loader/HASH(0x9d1690)/File/Spec/Win32.pm,
 /loader/HASH(0x9b3bac)/PAR/Filter.pm,
 /loader/HASH(0x9d19a8)/XSLoader.pm,
 /loader/HASH(0x9b3c3c)/PAR/Heavy.pm,
 /loader/HASH(0x9b3534)/warnings/register.pm,
 /loader/HASH(0x9b3b64)/PAR/Dist.pm,
 /loader/HASH(0x9d17f8)/IO/Seekable.pm,
 /loader/HASH(0x9b39b4)/File/Copy.pm,
 /loader/HASH(0x9d1a80)/base.pm,
 /loader/HASH(0x9b372c)/Config.pm,
 /loader/HASH(0x9b396c)/File/Basename.pm,
 /loader/HASH(0x9d1b58)/integer.pm,
 /loader/HASH(0x9abe60)/ActivePerl/Config.pm,
 /loader/HASH(0x9d1720)/IO.pm,
 /loader/HASH(0x9d1ac8)/bytes.pm,
 /loader/HASH(0x9b3654)/Carp.pm,
 /loader/HASH(0x9b35c4)/Archive/Zip.pm,
 /loader/HASH(0x9b38dc)/Exporter/Heavy.pm,
 /loader/HASH(0x9b3b1c)/File/Spec/Unix.pm,
 /loader/HASH(0x9b34a4)/vars.pm,
 /loader/HASH(0x9d1c78)/strict.pm,
 /loader/HASH(0x9d1b10)/constant.pm,
C:\DOCUME~1\malcolm\LOCALS~1\Temp\par-malcolm\cache-829b3fb1038d441c8df37c2083d9e6eef2ccfc26\inc\lib/t1b.pl,

 /loader/HASH(0x9b3bf4)/PAR/Filter/PodStrip.pm,
 /loader/HASH(0x9b3774)/Config_heavy.pl,
 /loader/HASH(0x9d1be8)/overload.pm,
 /loader/HASH(0x9b360c)/AutoLoader.pm,
 /loader/HASH(0x9d1768)/IO/File.pm,
 /loader/HASH(0x9d19f0)/auto/Compress/Zlib/autosplit.ix,
 /loader/HASH(0x9d1ba0)/lib.pm,
 /loader/HASH(0x9b3804)/DynaLoader.pm

Did it (mylib/t1b.pl).

C:\aaa>
------------end paste results

Reply via email to