Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Safer monkey-patching

by moritz (Cardinal)
on Jan 19, 2012 at 09:40 UTC ( #948731=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Safer monkey-patching
in thread Safer monkey-patching

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

Of course you can, but it's not really a benefit. As you wrote in the OP, monkey patching is often done to work around limitations in existing code that you don't want to patch. But writing $obj->Class::method() requires the author of that code to be aware of the issue, and when he is, he can simply write Class::method($obj) without requiring any monkey patching.

I do find your idea cute, but it really doesn't solve the "hard" problem, and the small problems it does solve seem to be either artifically constructed, or non-issues.


Comment on Re^3: Safer monkey-patching
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948731]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-10-23 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (129 votes), past polls