in reply to RFC: Module::Prefer

I agree, it is a hard one to search for on CPAN. However, it seems something similiar has already been done with the Best module.

-stvn

Replies are listed 'Best First'.
Re^2: RFC: Module::Prefer
by diotalevi (Canon) on Sep 25, 2006 at 20:48 UTC

    Updated: This happened ages ago. Go get the latest Best.


    Neat. Best is missing the feature where you specify the minimum version but otherwise looks good.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Very neat indeed. Is there some way to find out which module was selected? For example, CGI and CGI::Simple have different options, and I'd like to be able to deal with that -- one of the reasons I returned the name of the imported module during the prefer call.

      Also, can you do repeated 'use Best's? I thought use would only work once: am I mistaken?

      <radiant.matrix>
      A collection of thoughts and links from the minds of geeks
      The Code that can be seen is not the true Code
      I haven't found a problem yet that can't be solved by a well-placed trebuchet

        Repeated use() calls call the ->import function. The code is compiled only once but ->import is called every time unless you passed an empty parameter list like use Something ();. Best provides a which() function which can tell you which module loaded.

        use Best qw( CGI CGI::Simple ); my $q = Best->which( 'CGI' )->new;

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊