Roderich Schupp schrieb:
[...]
On the other hand, Glenn tried packing with
pp -M PerlIO ...
which is failry reasonable when seeing Can't locate PerlIO.pm errors.
But that didn't work either, because it doesn't pick up PerlIO::scalar.
One could add something like
'PerlIO.pm' = sub {
_glob_in_inc('PerlIO', 1),
to Module::ScanDeps %Preload table (i.e. for PerlIO.pm also pick up
recursively
anything below .../PerlIO). When I added this this,
scandeps.pl -B 'use PerlIO;'
prints the right thing, [...]
As I found out by talking to Nicholas and Rafael, PerlIO::scalar is the
only PerlIO layer which is loaded magically, that is, without specific
request:
open FOO, ':raw', 'filename'
would load PerlIO::raw. If you packaged this and PerlIO::raw couldn't be
found during subsequent execution of the binary, you would get a warning
about a missing PerlIO layer as follows:
Unknown PerlIO layer raw at -e line 1.
Whereas we're observing the case where :scalar is appended implicitly:
open FOO, '', \$scalar;
This *doesn't* trigger a warning if PerlIO::scalar isn't available which
wasn't discovered because it's always available with a normal perl 5.8.
Rafael fixed this for 5.9/10.
Now, we could add a Preload entry for all PerlIO layers if PerlIO is
explicitly requested or we could add one for just PerlIO::scalar because
that's the only one which will be automagically loaded by core perl.
A bit further out, it would be feasible to try to find PerlIO usage in
cases like
/open \s* $filehandle_or_scalar_regex \s* , \s* (|') $mode_regex :
(\w+) \1 \s* ,/
I know. q{} and friends exist. It's fragile. In that way, it fits well
into Module::ScanDeps. And I'm not going to implement it either.
but this discovered another bug (or
inconsistency at least):
pp -e 'use PerlIO; ...'
now includes all PerlIO::* stuff, while
pp -M PerlIO -e '...'
does not (inlcudes PerlIO.pm only) (using Module::Scandeps 0.66).
At first, I thought modules passed to pp via -M just weren't scanned at
all, but they are! (pp -M Math::Symbolic -e 'print Hello\n;' packages
Parse::RecDescent alright.)
I don't know what causes this and don't have the time to investigate.
Assuming you can't fix this in a minute either, would you consider
filing a M::SD bug report? Possibly just with this and the patch to
M::SD for %Preload-ing PerlIO::(scalar|.*).
Steffen