in reply to RE: Replacing a Subroutine at Runtime
in thread Replacing a Subroutine at Runtime

It undefines the subroutine that was previously defined as my_sub. It does so by getting the CODE ref part of the "my_sub" typeglob, then undefining the subroutine that that code ref references.

Since the goal of this is to replace that subroutine, this prevents the warning you would otherwise get (when you have warnings enabled) that "subroutine SUB has been redefined".

  • Comment on RE: RE: Replacing a Subroutine at Runtime