TAKING OVER A CLASS
The class is loaded, you want to change parts of it
- Take control of the class
-
require Some::Package; my $control = qtakeover( 'Some::Package' ); - Have your way with it
-
$control->override( foo => sub { ... } bar => sub { ... } ); - Restore the original method
-
$control->restore( 'foo' ); - The original class is completely restored when the control object is destroyed.
-
$control = undef;