in reply to Re: load a module or another: Dumper or dd
in thread load a module or another: Dumper or dd

My understanding is that OP wants to use Data::Dump if it's found on the system, and Data::Dumper if it isn't. I don't believe that this is a test situation that could be mocked out.

  • Comment on Re^2: load a module or another: Dumper or dd

Replies are listed 'Best First'.
Re^3: load a module or another: Dumper or dd
by markong (Pilgrim) on Jan 09, 2019 at 23:39 UTC

    Yes that part (the fact that the OP wants to optionally use a module if present) is quite clear. What it is not is why he wants to mock the absence of that particular module in its current setup/environment!

    The only thing which I thought would make sense is for testing that optionally loading code logic: I assumed that the problem was testing the module absence, which it can be done having a subroutine which mocks the loading of a fantasy module, e.g.: sub{ use Supercalifragilistichespiralidoso; 1 }