in reply to Re: RFC: Module::Prefer
in thread RFC: Module::Prefer

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.

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^3: RFC: Module::Prefer
by radiantmatrix (Parson) on Sep 25, 2006 at 23:01 UTC

    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;

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊