http://qs321.pair.com?node_id=692580

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

I like to use Devel::Cover to make sure that my test suite adequately covers my code. I've run into a bit of a conundrum on how to test something.

BEGIN { eval { require YAML::Syck; YAML::Syck->import }; #1 if ($@) { require YAML; YAML->import; #2 } }

Yes, I know I could use Best (use Best qw/YAML::Syck YAML/;), but for this project, it's not an option due to bureaucratic considerations.

My problem is that my tests only exercise the statements in #1, and not in #2 -- or vice-versa. I'm looking for a way that my test script can, e.g. temporarily make require YAML::Syck or YAML::Syck->import die so that I can automatically prove the fallback works.

I have tried to search for answers, but can't seem to find a set of search terms that provides any enlightenment. So, I turn to the Monestary: any ideas?

Updates:

<radiant.matrix>
Ramblings and references
“A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort.” — Herm Albright
I haven't found a problem yet that can't be solved by a well-placed trebuchet