in reply to Re^8: Upgrade-proofing overridden subroutines
in thread Upgrade-proofing overridden subroutines
I think your solution is too cute for the task. By putting such code in your codebase you endorse it for such problems; I feel this responsibility myself and I have no visibility nor reputation as a Perl expert. Since it is an approved solution, it will get used to fix the five other problem subs in Foo that featuritis may uncover. That is the tangle of interactions I would not induce.
The way I see to make the semantics predictable is to override both Foo::foo and foo, but I haven't thought out the timing and interactions of multiple usages.
My redefinition solution has the same weakness and should be used thusly:
Then make any other use of Foo illegal. I'm a fan of linting code for such things during the build process.# File: My_Foo.pm use Foo; package Foo; no warnings 'redefine'; sub Foo { "redefined Foo" } 1;
Be well,
rir
|
|---|