[cc'ed the Module:ScanDeps maintainer, see below] > When I do the following on Windows: > > pp -v -o out.exe -e "use diagnostics;" > > and then run .\out.exe, it gives the following error message: > > No diagnostics? at diagnostics.pm line 429. > Compilation failed in require at script/ppCTAFk.pl line 1. > BEGIN failed--compilation aborted at script/ppCTAFk.pl line 1. ... > pp -v -o out.exe -a "\perl\lib\Pod\perldiag.pod" -e "use diagnostics;"
Almost, but you must make sure that perldiag.pod is included in the zip as "lib/pod/perldiag.pod" (you can see the contents with unzip -l out.exe ), try pp -v -o out.exe -a "\perl\lib\Pod\perldiag.pod;lib/pod/perldiag.pod" -e "use diagnostics;" BUT... this workaround shouldn't be necessary at all: (1) when pp packs diagnostics.pm it also patches it: diff installed/diagnostics.pm included-in-zip/diagnostics.pm @@ -326,7 +153,11 @@ local $_; my $header; my $for_item; - while (<POD_DIAG>) { + require PAR; + for(map "$_\n\n", split/\r?\n(?:\r?\n)*/, + PAR::read_file("lib/Pod/perldiag.pod") || + PAR::read_file("lib/pod/perldiag.pod") + ) { unescape(); if ($PRETTY) { i.e. instead of opening a "real" file, try to read the zip member named "lib/Pod/perldiag.pod" (or "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): 'diagnostics.pm' => sub { _find_in_inc('Pod/perldiag.pod') ? 'Pod/perldiag.pl' : 'pod/perldiag.pod'; }, i.e. when we saw that "diagnostics.pm" was requested (e.g. because of "use diagnostics;") then add "Pod/perldiag.pl" or "pod/perldiag.pod", depending on whether we can find the file "Pod/perldiag.pod" via @INC. 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. Cheers, Roderich