K
kj
During testing it'd often be *very handy* to be able to redefine
a function/subroutine. (E.g., subroutine Foo::A gets a particular
value from subroutine Foo::B, which in turn performs some elaborate
websearch to get this value; it would simplify the testing of Foo::A
tremendously to be able to replace Foo::B with a simple sub that
returns a hard-coded value, thus decoupling the testing of Foo::A
from the testing of Foo::B.)
When subclassing is an option, that's usually the way to go, but
now I'm dealing with packages that are not using the OO calling
model, so this is not an option.
I'm thinking that there must be some "symbol table surgery" that
I may be able to perform to temporarily replace the original sub
with another one, but I'm a bit shaky on symbol table manipulations.
Be that as it may, any advice on how to redefine the likes of Foo::B
during testing would be much appreciated.
Thanks!
kj
a function/subroutine. (E.g., subroutine Foo::A gets a particular
value from subroutine Foo::B, which in turn performs some elaborate
websearch to get this value; it would simplify the testing of Foo::A
tremendously to be able to replace Foo::B with a simple sub that
returns a hard-coded value, thus decoupling the testing of Foo::A
from the testing of Foo::B.)
When subclassing is an option, that's usually the way to go, but
now I'm dealing with packages that are not using the OO calling
model, so this is not an option.
I'm thinking that there must be some "symbol table surgery" that
I may be able to perform to temporarily replace the original sub
with another one, but I'm a bit shaky on symbol table manipulations.
Be that as it may, any advice on how to redefine the likes of Foo::B
during testing would be much appreciated.
Thanks!
kj