I'm not sure if I understand your proposal, which is probable, given your hacking skills. However I don't want to force $_[1] to hold "Whatever.pm" for use in the same sub - I want it to be modified as a side-effect of the sub having been called, and I don't want to change the value from read-only either: I "want" it not to be read-only in the first place.
I was thinking of something along these lines: suppose that one writes some modules in different versions for some different OSen (OK: as I premised since the beginning, I know there are other ways to do this), well if she had this feature available then she may do something like:
use lib sub {
for (qw/Foo.pm Bar.pm Baz.pm/) {
if ($_[1] eq $_) {
$_[1] =~ s/\./-$^O./;
last;
}
}
# let perl go on searching the 'faked' .pm!
undef;
};
(There are probably better examples.)
I admit that this opens an ambiguity as to what should be shown in case the modified module can't be found: is it, say, Foo.pm or Foo-linux.pm that can't be found? Probably, both, I would say: the error message may report both the original name and the "current" (at failure time) one, if they differ. |