http://www.perlmonks.org?node_id=614580


in reply to Gracefully Downgrading Behavior

(Here be plugs.)

When there are several providers of the functionality that have compatible APIs, you can use Best. With modules that just export functions, you simply replace the use line:

use YAML; # This module is slow! # So if you want to try a faster one first: use Best qw(YAML::Syck YAML); print Dump({ some => 'hash' }); # Dumping provided by Best Possible YA +ML module

There's knobs you can use to rewire stuff as in your is_deeply example; and a which function is provided so you can get the name of the module that was actually loaded to write factories with.

use Best qw(OOPishProv AnotherOOPyProv::Serving::As::Fallback); my $obj = Best->which("OOPishProv")->new;

If you're out for less syntax, you might like to try the possibly too-magical Class::TransparentFactory.