[rt.cpan.org #111455] unable to use -x and -u with pp

[email protected] ("Roderich Schupp via RT")
Newsgroups perl.par
Message-ID <[email protected]>
Wed Jan 27 08:38:40 2016: Request 111455 was acted upon.
Transaction: Correspondence added by RSCHUPP
       Queue: PAR-Packer
     Subject: unable to use -x and -u with pp
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111455 >


On 2016-01-27 01:39:00, SLAFFAN wrote:
> Running pp with both the -u and -x options fails. It appears that some
> of the text files under the unicore directory are being executed by
> Module::ScanDeps.  See code and results below.

Yeah, "pp -u ..." is just short for "pp -M utf8_heavy.pl ..." so combining
this with "-x" gets the same result :( In fact, "pp -x -M Foo::Bar ..." with
a Foo::Bar that has a %Preload rule in Module/ScanDeps.pm that adds anything
NOT perlish will provoke the same problem. Other examples are charnames or 
LWP::MediaTypes. 

Turns out that "pp -x" - counter to what I would expect - does not only 
execute the actual input file(s), but also every module added with -M and 
everything it "depends" on according to the %Preload rules. The problem
has been lurking for ages, but - since running "perl /path/to/module.pm" 
usually doesn't generate an error - nobody noticed.

BTW, adding dependencies from "-M" arguments to the list of input files
affects not only "-x", but the default use case as well.
This behaviour also explains what's going on in #110480: 
try "pp -M utf8_heavy.pl ..." (no "-x") and look at the contents of the
generated exe (as a zip file). It contains every non-pm file, e.g. 1000.pl,
below the "unicore" directory TWICE, once as "lib/unicore/lib/Nv/1000.pl"
(correct) and also as "lib/1000.pl".

Can you try the patch below?

Cheers, Roderich


Index: lib/PAR/Packer.pm
===================================================================
--- lib/PAR/Packer.pm   (revision 1642)
+++ lib/PAR/Packer.pm   (working copy)
@@ -737,7 +737,6 @@
             skip    => \%skip,
 #            warn_missing => $args->{warn_missing},
         );
-        push @files, map {&$inc_find($_)} @preload;
     }
     push @files, @$input;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.