Roderich Schupp (ext) schrieb:
[cc'ed the Module:ScanDeps maintainer, see below]

Funny, how I became the Module::ScanDeps maintainer... I wanted something fixed so I just fixed it myself. And got the permission from Audrey to upload the new version. :)

[snip - problem description and workaround]

(1) when pp packs diagnostics.pm it also patches it:
[...]
+            PAR::read_file("lib/Pod/perldiag.pod") ||
+            PAR::read_file("lib/pod/perldiag.pod")
[...]


(2) there is a corresponding rule in Module::ScanDeps (which is used
    by pp to recursively scan your script for use/require/... modules):
[...]
        _find_in_inc('Pod/perldiag.pod')
          ? 'Pod/perldiag.pl'
          : 'pod/perldiag.pod';
[...]

I think that's the real problem here. For ActiveState Perl, the
following command

C:\>perl -MModule::ScanDeps -e "print
Module::ScanDeps::_find_in_inc('Pod/perldiag.pod')"

prints

C:/Perl/lib/Pod/perldiag.pod

i.e. _find_in_inc() was true, so ScanDeps goes looking for
"Pod/perldiag.pl".
But this doesn't exist in this Perl installation, hence isn't included
in out.exe
(ScanDeps won't complain if it misses out on some files). Ironically the
above
command prints nothing on, say, Solaris - note the capital P in
"Pod/..." :), hence ScanDeps goes looking for "pod/perldiag.pod" (which _can_ be found
via @INC)
and your example would have worked there. Yet a third variant is Cygwin
Perl,
which also prints nothing, but can't find "pod/perldiag.pod" later on
(because PODs are installed in a directory (usr/lib/perl5/5.8/pods -
note the trailing S)
that's not in @INC), with the same result as yours.

Puh!

Let's sum this up as: The current situation is a mess!

Now, how do we clean this up? We can't use Module::ScanDeps to map a file to another name, we can just return a list of files to include.

If we look at diagnostics.pm of 5.8.8, we find:
my @trypod = (
  "$archlib/pod/perldiag.pod",
  "$privlib/pod/perldiag-$Config{version}.pod",
  "$privlib/pod/perldiag.pod",
  "$archlib/pods/perldiag.pod",
  "$privlib/pods/perldiag-$Config{version}.pod",
  "$privlib/pods/perldiag.pod",
);
and then an addition of "pod/perldiag.pod" if it exists.

Then, it just looks for the first existing file.

We could
a) Patch Module::ScanDeps as follows:
  'diagnostics.pm' => sub {
        for (qw(
                 Pod/perldiag.pod
                 pod/perldiag.pod
                 ...
               )
        ) {
          return $_ if _find_in_inc($_);
        }
  },

modulo indentation style and amend it with all possible locations of the diagnostics information as taken from diagnostics.pm

b) Patch PAR so that it looks in the ZIP for all those files and uses the first one.

This is a hack, but diagnostics.pm doesn't do it differently, so I guess it is okay.

Comments?

Steffen

Reply via email to