LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

Is it possible to check if a module is available for use in @INC, BUT without side effects?

I mean eval { "require MODULE" } will at least compile MODULE.pm and execute any BEGIN block inside at compile time.

Background: I have a project where I allow to dynamically add freely named modules via INC-hooks*, it would be nice to know beforehand if there are potential conflicts with already available modules.

TIA!

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Update

of course apart of the obvious solution to parse the dirs and hooks in @INC by myself, like shown in require

*) see require for explanation

Replies are listed 'Best First'.
Re: Checking @INC for available modules without side-effects?
by haukex (Archbishop) on Mar 15, 2019 at 21:10 UTC
      GREAT, thanks!!!

      (I should check corelist more often. :)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice