in reply to locally redefining subroutine in module
There is a much cleaner and easier way:
{ local *Foo::new = sub { require MockFoo; return MockFoo->new; }; ... tests ... }; # Foo::new is restored to its old value
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: locally redefining subroutine in module
by Jasper (Chaplain) on Jun 30, 2004 at 10:16 UTC |