#!/usr/bin/perl use Your::Module; use Proc::Background; use Test::Resub qw(resub); # disable Proc::Background->new for the scope of this block { my $fake_new = sub { return bless {}, 'Proc::Background'; # or whatever }; my $resub = resub 'Proc::Background::new', $fake_new; # continue on your merry way, content knowing that # your $fake_new is getting called. } # scope of $resub object ends, its DESTROYER restores # the original Proc::Background::new.