Subject: | fake_module with import |
It would be useful if $mock->fake_module() could provide support for
generating a standard exporter type import function. I am getting fed up
with writing horrid code like:
$mock->fake_module(
'XXX::Util::Shutdown',
import => sub {
package XXX::Util::Shutdown;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(reboot);
__PACKAGE__->export_to_level(1, "XXX::Util::Shutdown", 'reboot');
package main;
},
reboot => \&reboot,
);
Test::MockModule is no help as it assumes the module being mocked is
available to load and modify.
I am trying to test against modules that export with Exporter and that
are not available in the source/test environment and will only become
available in the [embedded] production environment which does not
include the tests.