in reply to Re: Safer monkey-patching
in thread Safer monkey-patching
Indeed, this problem is not really solvable. However, my solution does offer a partial way forward.
Let's imagine that My::AwesomeError and Your::GroovyError both superclass Example::Error, and both add an asplode method.
We can then do:
my $err = Example::Error->new('Heat death of universe detected!'); $err->My::AwesomeError::asplode(); $err->Your::GroovyError::asplode(); $err->asplode(); # Russian roulette
With true monkey patching, where My::AwesomeError and Your::GroovyError each defined the asplode method directly in the Example::Error namespace, we wouldn't get the option to do the above.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Safer monkey-patching
by moritz (Cardinal) on Jan 19, 2012 at 09:40 UTC |
In Section
Meditations