in reply to How not to check if a module is installed
I think it is high time for a new special global to cache the return value from the first time a module was required.
It seems a bug in Perl for "require Foo::Bar;" to succeed when Foo/Bar.pm is in a failing state (such as not existing). I understand the mechanism of this behavior but I still consider it a bug that a reasonable use of eval has the unfortunate consequnce.
Now, with a new %LIB (or whatever it gets called) to hold the value returned by the first require, then subsequent requires can return the same thing as the first require did. This fixes the above bug. It also allows modules to usefully return a value to the script/module(s) that require them (something I've seen more than one good use for).
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How not to check if a module is installed (bug)
by xdg (Monsignor) on Oct 24, 2007 at 16:46 UTC |