sub fake_module { my ($class, $modname, %subs) = @_; # replace methods in $modname with those in %subs $INC{ $modname . '.pm' } = 1; # pretend we have already loaded the module foreach my $sub (keys %subs) { # for each implementation provided ... *{ $module . '::' . $sub } = $subs{ $sub }; # store the provided implementation in the symbol table } }