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

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

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

    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;

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊