libmodule-want-perl

Module to check @inc only once for wanted modules
  https://metacpan.org/release/Module-Want
  0
  no reviews



Sometimes you want to lazy load a module for use in, say, a loop or function. first you do the eval-require but then realize if the module is not available it will re-search @inc each time. so then you add a lexical boolean to your eval and do the same simple logic all over the place.

module::want encapsulates that logic so that have_mod() is like eval { require x; 1 } but if the module can't be loaded it will remember that fact and not look in @inc again on subsequent calls.