Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

strawberry par::packer, @INC and the difference between -c and -x

by Boldra (Deacon)
on Nov 26, 2009 at 09:08 UTC ( #809508=perlquestion: print w/ replies, xml ) Need Help??
Boldra has asked for the wisdom of the Perl Monks concerning the following question:

For some reason I'm not getting the libraries in my par exe that I want. I've boiled the problem down to the following test case:


package strict; $VERSION = 1001; 1;
use strict 100; print "strict=$INC{''}\n";
Then when packaging I get:
C:\temp\test>c:\strawberry\perl\bin\perl.exe c:\strawberry\perl\bin\pp + -x -I lib strict=lib/ Unquoted string "prefork" may clash with future reserved word at c:/st +rawberry/perl/site/lib/ line 16, <_FH> chunk 1. C:\temp\test>c:\strawberry\perl\bin\perl.exe c:\strawberry\perl\bin\pp + -c -I lib strict version 100 required--this is only version 1.04 at GbLRp4 line +4. BEGIN failed--compilation aborted at GbLRp4 line 4. Couldn't open GbLRp4.out at c:/strawberry/perl/site/lib/Module/ScanDep line 1266.
The warning about the unquoted string doesn't really interest me. The point is that -x works (finds strict version 1001), but -c (or -o) doesn't work.

What I'm trying to do is create a portable binary, with a different version of a library which is also in core. It seems that when I try to create an exe (with -o or -c), my local is ignored in favour of the global one. In reality it's Win32::TieRegistry I'm trying to distribute with my exe (because the cpan version still doesn't include this patch).

I've also tried adding -Ilib to the perl switches (between perl.exe and pp). As a workaround I will update my global version of the module just for compiling :(.

Thanks for any help on this.

- Boldra

Comment on strawberry par::packer, @INC and the difference between -c and -x
Select or Download Code
Replies are listed 'Best First'.
Re: strawberry par::packer, @INC and the difference between -c and -x
by Anonymous Monk on Nov 26, 2009 at 10:48 UTC
    There is no report about that 64 issue at

    Win32::TieRegistry is not a core module

    It works for me ( just copied strict, changed version to 666)

    $ cat #!/usr/bin/perl -- use strict; warn $INC{''}; warn $strict::VERSION; $ perl C:/perl/5.10.1/lib/ at line 4. 1.04 at line 5. $ perl -Ilib lib/ at line 4. 666 at line 5. $ pp -I lib $ a.exe /loader/HASH(0xa9428c)/ at script/ line 4. 666 at script/ line 5. $ pmvers PAR PAR::Packer PAR: 0.994 PAR::Packer: 1.001 $
    update: I didn't use -c, but with -c I get a warning
    $ pp -c -I lib Different modules for file '' were found. -> Using 'C:/perl/5.10.1/lib/'. -> Ignoring 'C:/temp/lib/'.
    no issue with -o
    $ pp -o mystrict.exe -I lib $ mystrict.exe /loader/HASH(0xa942d4)/ at script/ line 4. 666 at script/ line 5.
    same behaviour with -c even if I load my strict first
    $ perl -Ilib -Mstrict -S pp -c -I lib Different modules for file '' were found. -> Using 'C:/perl/5.10.1/lib/'. -> Ignoring 'C:/temp/lib/'.
    The error message comes from Module::ScanDeps. This is probably a bug.
Re: strawberry par::packer, @INC and the difference between -c and -x
by morgon (Deacon) on Nov 27, 2009 at 23:42 UTC
    I am rather new to both Windows and PAR, so maybe I don't really understand what you are trying to achieve, but here are my experiments with Strawberry 5.10.1 on Windows XP (with cygwin):

    In my working directory I have a script "" that looks like this:

    BEGIN { unshift @INC, "." } use strict; print "I have: $strict::VERSION\n";
    Running it produces "I have: 1.04".

    Now I make a copy of to my local directory and change the version number to 3.45 like this:

    cp c:/strawberry/perl/lib/ . perl -i.old -pe 's/VERSION = .*/VERSION = "3.45";/'
    Running now produces "I have 3.45" - so far so good.
    Now I want to build an exe that contains my modified but -x does not do the trick:
    perl C:/strawberry/perl/bin/pp -o a.exe -x a.exe
    This produces "I have: 1.04" so pp packed the core-lib with surprises me as I thought -x (running the script) would detect that we are picking up our modified - so my impression is that -x does not work (or I don't understand what it should do).

    However --lib seems to work fine:

    perl C:/strawberry/perl/bin/pp -o a.exe --lib=. a.exe
    Now I get "I have: 3.45" as desired.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://809508]
Approved by moritz
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2015-11-29 07:31 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (748 votes), past polls