The Perl 5 module Sub::Override provides a way to easily override subroutines.