From: laotse@... Date: 2001-06-28T13:15:12+09:00 Subject: [ruby-talk:16988] using alias_method I have a question about using alias_method. Here's what I'm trying to do: class Redef def hello print "hello\n" end def rename eval <<-ENDDEF def hello print "goodbye\n" end ENDDEF end end test = Redef.new test.hello test.rename test.hello Okay, the above works just fine and dandy. But what I also want to do is alias "hello" to a new method name to preserve it before I change it. At first I thought alias_method looked promising. Unfortunately, its a private instance method of module Module and I can't figure out any way to use it within a class. My ultimate goal is to have a mixin module, which contains a method "wrap_method", which can be included in any class. Including it would add the wrap_method method which would alias an existing method in that class to a new name, then redefine the method. Can I use alias_method somehow? If not, is there another way I can accomplish this? ----------------------------------------------------------------------------- Brian Knox Just Another Perl Hacker perl -le '$_="6110>374086;2064208213:90<307;55";tr[0->][ LEOR!AUBGNSTY];print'